Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@ public interface MetricsRegionSource extends Comparable<MetricsRegionSource> {
void updateDelete();

/**
* Update time of gets
* @param mills time for this get operation.
* Update related counts of gets
*/
void updateGet(long mills);
void updateGet();

/**
* Update time used of resultScanner.next().
* Update related counts of resultScanner.next().
*/
void updateScanTime(long mills);
void updateScan();

/**
* Update related counts of increments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ public void updateDelete() {
}

@Override
public void updateGet(long mills) {
public void updateGet() {
regionGet.incr();
}

@Override
public void updateScanTime(long mills) {
public void updateScan() {
regionScan.incr();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7912,12 +7912,11 @@ private List<Cell> get(Get get, boolean withCoprocessor, long nonceGroup, long n
private List<Cell> getInternal(Get get, boolean withCoprocessor, long nonceGroup, long nonce)
throws IOException {
List<Cell> results = new ArrayList<>();
long before = EnvironmentEdgeManager.currentTime();

// pre-get CP hook
if (withCoprocessor && (coprocessorHost != null)) {
if (coprocessorHost.preGet(get, results)) {
metricsUpdateForGet(results, before);
metricsUpdateForGet();
return results;
}
}
Expand All @@ -7941,14 +7940,14 @@ private List<Cell> getInternal(Get get, boolean withCoprocessor, long nonceGroup
coprocessorHost.postGet(get, results);
}

metricsUpdateForGet(results, before);
metricsUpdateForGet();

return results;
}

void metricsUpdateForGet(List<Cell> results, long before) {
void metricsUpdateForGet() {
if (this.metricsRegion != null) {
this.metricsRegion.updateGet(EnvironmentEdgeManager.currentTime() - before);
this.metricsRegion.updateGet();
}
if (this.rsServices != null && this.rsServices.getMetrics() != null) {
rsServices.getMetrics().updateReadQueryMeter(this, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public void updateDelete() {
source.updateDelete();
}

public void updateGet(final long t) {
source.updateGet(t);
public void updateGet() {
source.updateGet();
}

public void updateScanTime(final long t) {
source.updateScanTime(t);
public void updateScan() {
source.updateScan();
}

public void updateFilteredRecords() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2518,11 +2518,10 @@ private Result get(Get get, HRegion region, RegionScannersCloseCallBack closeCal

// This method is almost the same as HRegion#get.
List<Cell> results = new ArrayList<>();
long before = EnvironmentEdgeManager.currentTime();
// pre-get CP hook
if (region.getCoprocessorHost() != null) {
if (region.getCoprocessorHost().preGet(get, results)) {
region.metricsUpdateForGet(results, before);
region.metricsUpdateForGet();
return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null,
stale);
}
Expand Down Expand Up @@ -2557,7 +2556,7 @@ private Result get(Get get, HRegion region, RegionScannersCloseCallBack closeCal
if (region.getCoprocessorHost() != null) {
region.getCoprocessorHost().postGet(get, results);
}
region.metricsUpdateForGet(results, before);
region.metricsUpdateForGet();

return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale);
}
Expand Down Expand Up @@ -3461,13 +3460,14 @@ private void scan(HBaseRpcController controller, ScanRequest request, RegionScan
region.closeRegionOperation();
// Update serverside metrics, even on error.
long end = EnvironmentEdgeManager.currentTime();

long responseCellSize = 0;
long blockBytesScanned = 0;
if (rpcCall != null) {
responseCellSize = rpcCall.getResponseCellSize();
blockBytesScanned = rpcCall.getBlockBytesScanned();
}
region.getMetrics().updateScanTime(end - before);
region.getMetrics().updateScan();
final MetricsRegionServer metricsRegionServer = server.getMetrics();
if (metricsRegionServer != null) {
metricsRegionServer.updateScan(region, end - before, responseCellSize, blockBytesScanned);
Expand Down