This is an automated email from the ASF dual-hosted git repository.

wangzheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 043da5f  HBASE-25435 Slow metric value can be configured (#2823)
043da5f is described below

commit 043da5f5eebd009a14780d12b4e70011b200b5bb
Author: leyangyueshan <15891721...@163.com>
AuthorDate: Thu Dec 31 22:37:31 2020 +0800

    HBASE-25435 Slow metric value can be configured (#2823)
    
    * HBASE-25435 Slow metric value can be configured
    
    * fix  HBASE-25435
    
    * hbase-25435 add blank
    
    * fix hbase-25435-2
    
    Co-authored-by: stevenxi <steve...@tencent.com>
---
 .../hadoop/hbase/regionserver/MetricsRegionServer.java     | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
index 6bbb620..3bd787d 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
@@ -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);
     quotaSource = 
CompatibilitySingletonFactory.getInstance(MetricsRegionServerQuotaSource.class);
     serverReadQueryMeter = metricRegistry.meter("ServerReadQueryPerSecond");
     serverWriteQueryMeter = metricRegistry.meter("ServerWriteQueryPerSecond");
@@ -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);

Reply via email to