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(); void updateDelete();
/** /**
* Update time of gets * Update related counts of gets
* @param mills time for this get operation.
*/ */
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. * Update related counts of increments.

View File

@ -149,12 +149,12 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
} }
@Override @Override
public void updateGet(long mills) { public void updateGet() {
regionGet.incr(); regionGet.incr();
} }
@Override @Override
public void updateScanTime(long mills) { public void updateScan() {
regionScan.incr(); 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) private List<Cell> getInternal(Get get, boolean withCoprocessor, long nonceGroup, long nonce)
throws IOException { throws IOException {
List<Cell> results = new ArrayList<>(); List<Cell> results = new ArrayList<>();
long before = EnvironmentEdgeManager.currentTime();
// pre-get CP hook // pre-get CP hook
if (withCoprocessor && (coprocessorHost != null)) { if (withCoprocessor && (coprocessorHost != null)) {
if (coprocessorHost.preGet(get, results)) { if (coprocessorHost.preGet(get, results)) {
metricsUpdateForGet(results, before); metricsUpdateForGet();
return results; return results;
} }
} }
@ -7941,14 +7940,14 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
coprocessorHost.postGet(get, results); coprocessorHost.postGet(get, results);
} }
metricsUpdateForGet(results, before); metricsUpdateForGet();
return results; return results;
} }
void metricsUpdateForGet(List<Cell> results, long before) { void metricsUpdateForGet() {
if (this.metricsRegion != null) { if (this.metricsRegion != null) {
this.metricsRegion.updateGet(EnvironmentEdgeManager.currentTime() - before); this.metricsRegion.updateGet();
} }
if (this.rsServices != null && this.rsServices.getMetrics() != null) { if (this.rsServices != null && this.rsServices.getMetrics() != null) {
rsServices.getMetrics().updateReadQueryMeter(this, 1); rsServices.getMetrics().updateReadQueryMeter(this, 1);

View File

@ -50,12 +50,12 @@ public class MetricsRegion {
source.updateDelete(); source.updateDelete();
} }
public void updateGet(final long t) { public void updateGet() {
source.updateGet(t); source.updateGet();
} }
public void updateScanTime(final long t) { public void updateScan() {
source.updateScanTime(t); source.updateScan();
} }
public void updateFilteredRecords() { public void updateFilteredRecords() {

View File

@ -2518,11 +2518,10 @@ public class RSRpcServices extends HBaseRpcServicesBase<HRegionServer>
// This method is almost the same as HRegion#get. // This method is almost the same as HRegion#get.
List<Cell> results = new ArrayList<>(); List<Cell> results = new ArrayList<>();
long before = EnvironmentEdgeManager.currentTime();
// pre-get CP hook // pre-get CP hook
if (region.getCoprocessorHost() != null) { if (region.getCoprocessorHost() != null) {
if (region.getCoprocessorHost().preGet(get, results)) { if (region.getCoprocessorHost().preGet(get, results)) {
region.metricsUpdateForGet(results, before); region.metricsUpdateForGet();
return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null,
stale); stale);
} }
@ -2557,7 +2556,7 @@ public class RSRpcServices extends HBaseRpcServicesBase<HRegionServer>
if (region.getCoprocessorHost() != null) { if (region.getCoprocessorHost() != null) {
region.getCoprocessorHost().postGet(get, results); region.getCoprocessorHost().postGet(get, results);
} }
region.metricsUpdateForGet(results, before); region.metricsUpdateForGet();
return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale); return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale);
} }
@ -3461,13 +3460,14 @@ public class RSRpcServices extends HBaseRpcServicesBase<HRegionServer>
region.closeRegionOperation(); region.closeRegionOperation();
// Update serverside metrics, even on error. // Update serverside metrics, even on error.
long end = EnvironmentEdgeManager.currentTime(); long end = EnvironmentEdgeManager.currentTime();
long responseCellSize = 0; long responseCellSize = 0;
long blockBytesScanned = 0; long blockBytesScanned = 0;
if (rpcCall != null) { if (rpcCall != null) {
responseCellSize = rpcCall.getResponseCellSize(); responseCellSize = rpcCall.getResponseCellSize();
blockBytesScanned = rpcCall.getBlockBytesScanned(); blockBytesScanned = rpcCall.getBlockBytesScanned();
} }
region.getMetrics().updateScanTime(end - before); region.getMetrics().updateScan();
final MetricsRegionServer metricsRegionServer = server.getMetrics(); final MetricsRegionServer metricsRegionServer = server.getMetrics();
if (metricsRegionServer != null) { if (metricsRegionServer != null) {
metricsRegionServer.updateScan(region, end - before, responseCellSize, blockBytesScanned); metricsRegionServer.updateScan(region, end - before, responseCellSize, blockBytesScanned);