HBASE-27712 Remove unused params in region metrics (#5100)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
tianhang 2023-06-01 17:13:13 +08:00 committed by GitHub
parent 7cc15fc92b
commit 7b571ca9e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 20 deletions

View File

@ -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.

View File

@ -149,12 +149,12 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
}
@Override
public void updateGet(long mills) {
public void updateGet() {
regionGet.incr();
}
@Override
public void updateScanTime(long mills) {
public void updateScan() {
regionScan.incr();
}

View File

@ -7912,12 +7912,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
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;
}
}
@ -7941,14 +7940,14 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
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);

View File

@ -50,12 +50,12 @@ public class MetricsRegion {
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() {

View File

@ -2518,11 +2518,10 @@ public class RSRpcServices extends HBaseRpcServicesBase<HRegionServer>
// 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);
}
@ -2557,7 +2556,7 @@ public class RSRpcServices extends HBaseRpcServicesBase<HRegionServer>
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);
}
@ -3461,13 +3460,14 @@ public class RSRpcServices extends HBaseRpcServicesBase<HRegionServer>
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);