HBASE-25435 Slow metric value can be configured

Signed-off-by: jediwang <jediwang@tencent.com>
This commit is contained in:
leyangyueshan 2020-12-31 22:37:31 +08:00 committed by jediwang
parent f5a7fffd8b
commit 35648278fc
1 changed files with 9 additions and 5 deletions

View File

@ -42,6 +42,7 @@ public class MetricsRegionServer {
"hbase.regionserver.enable.table.latencies";
public static final boolean RS_ENABLE_TABLE_METRICS_DEFAULT = true;
public static final String SLOW_METRIC_TIME = "hbase.ipc.slow.metric.time";
private final MetricsRegionServerSource serverSource;
private final MetricsRegionServerWrapper regionServerWrapper;
private RegionServerTableMetrics tableMetrics;
@ -53,6 +54,8 @@ public class MetricsRegionServer {
private Timer bulkLoadTimer;
private Meter serverReadQueryMeter;
private Meter serverWriteQueryMeter;
protected long slowMetricTime;
protected static final int DEFAULT_SLOW_METRIC_TIME = 1000; // milliseconds
public MetricsRegionServer(MetricsRegionServerWrapper regionServerWrapper, Configuration conf,
MetricsTable metricsTable) {
@ -68,6 +71,7 @@ public class MetricsRegionServer {
// create and use metrics from the new hbase-metrics based registry.
bulkLoadTimer = metricRegistry.timer("Bulkload");
slowMetricTime = conf.getLong(SLOW_METRIC_TIME, DEFAULT_SLOW_METRIC_TIME);
serverReadQueryMeter = metricRegistry.meter("ServerReadQueryPerSecond");
serverWriteQueryMeter = metricRegistry.meter("ServerWriteQueryPerSecond");
quotaSource = CompatibilitySingletonFactory.getInstance(MetricsRegionServerQuotaSource.class);
@ -109,7 +113,7 @@ public class MetricsRegionServer {
if (tableMetrics != null && tn != null) {
tableMetrics.updatePutBatch(tn, t);
}
if (t > 1000) {
if (t > slowMetricTime) {
serverSource.incrSlowPut();
}
serverSource.updatePutBatch(t);
@ -135,7 +139,7 @@ public class MetricsRegionServer {
if (tableMetrics != null && tn != null) {
tableMetrics.updateDeleteBatch(tn, t);
}
if (t > 1000) {
if (t > slowMetricTime) {
serverSource.incrSlowDelete();
}
serverSource.updateDeleteBatch(t);
@ -166,7 +170,7 @@ public class MetricsRegionServer {
if (tableMetrics != null && tn != null) {
tableMetrics.updateGet(tn, t);
}
if (t > 1000) {
if (t > slowMetricTime) {
serverSource.incrSlowGet();
}
serverSource.updateGet(t);
@ -177,7 +181,7 @@ public class MetricsRegionServer {
if (tableMetrics != null && tn != null) {
tableMetrics.updateIncrement(tn, t);
}
if (t > 1000) {
if (t > slowMetricTime) {
serverSource.incrSlowIncrement();
}
serverSource.updateIncrement(t);
@ -188,7 +192,7 @@ public class MetricsRegionServer {
if (tableMetrics != null && tn != null) {
tableMetrics.updateAppend(tn, t);
}
if (t > 1000) {
if (t > slowMetricTime) {
serverSource.incrSlowAppend();
}
serverSource.updateAppend(t);