hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-17957 Custom metrics of replicate endpoints don't prepend "source." to global metrics
Date Mon, 01 May 2017 15:11:55 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 1848353fd -> ef94de3eb


HBASE-17957 Custom metrics of replicate endpoints don't prepend "source." to global metrics

Signed-off-by: tedyu <yuzhihong@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ef94de3e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ef94de3e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ef94de3e

Branch: refs/heads/master
Commit: ef94de3eb7ecbf2bb45ce1a3cbfb861ef4c1a417
Parents: 1848353
Author: yoshida.shinya <yoshida.shinya@linecorp.com>
Authored: Tue Apr 25 11:11:20 2017 +0900
Committer: tedyu <yuzhihong@gmail.com>
Committed: Mon May 1 08:11:59 2017 -0700

----------------------------------------------------------------------
 .../MetricsReplicationGlobalSourceSource.java         | 14 ++++++++------
 .../hbase/replication/TestReplicationEndpoint.java    | 14 ++++++++------
 2 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ef94de3e/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSource.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSource.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSource.java
index 7a34e45..712096d 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSource.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSource.java
@@ -23,6 +23,8 @@ import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
 import org.apache.hadoop.metrics2.lib.MutableHistogram;
 
 public class MetricsReplicationGlobalSourceSource implements MetricsReplicationSourceSource{
+  private static final String KEY_PREFIX = "source.";
+
   private final MetricsReplicationSourceImpl rms;
 
   private final MutableHistogram ageOfLastShippedOpHist;
@@ -196,32 +198,32 @@ public class MetricsReplicationGlobalSourceSource implements MetricsReplicationS
 
   @Override
   public void setGauge(String gaugeName, long value) {
-    rms.setGauge(gaugeName, value);
+    rms.setGauge(KEY_PREFIX + gaugeName, value);
   }
 
   @Override
   public void incGauge(String gaugeName, long delta) {
-    rms.incGauge(gaugeName, delta);
+    rms.incGauge(KEY_PREFIX + gaugeName, delta);
   }
 
   @Override
   public void decGauge(String gaugeName, long delta) {
-    rms.decGauge(gaugeName, delta);
+    rms.decGauge(KEY_PREFIX + gaugeName, delta);
   }
 
   @Override
   public void removeMetric(String key) {
-    rms.removeMetric(key);
+    rms.removeMetric(KEY_PREFIX + key);
   }
 
   @Override
   public void incCounters(String counterName, long delta) {
-    rms.incCounters(counterName, delta);
+    rms.incCounters(KEY_PREFIX + counterName, delta);
   }
 
   @Override
   public void updateHistogram(String name, long value) {
-    rms.updateHistogram(name, value);
+    rms.updateHistogram(KEY_PREFIX + name, value);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/ef94de3e/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
index 4925aab..c63a69b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
@@ -310,9 +310,11 @@ public class TestReplicationEndpoint extends TestReplicationBase {
     MetricsSource source = new MetricsSource(id, singleSourceSource, globalSourceSource);
     String gaugeName = "gauge";
     String singleGaugeName = "source.id." + gaugeName;
+    String globalGaugeName = "source." + gaugeName;
     long delta = 1;
     String counterName = "counter";
     String singleCounterName = "source.id." + counterName;
+    String globalCounterName = "source." + counterName;
     long count = 2;
     source.decGauge(gaugeName, delta);
     source.getMetricsContext();
@@ -327,21 +329,21 @@ public class TestReplicationEndpoint extends TestReplicationBase {
     source.updateHistogram(counterName, count);
 
     verify(singleRms).decGauge(singleGaugeName, delta);
-    verify(globalRms).decGauge(gaugeName, delta);
+    verify(globalRms).decGauge(globalGaugeName, delta);
     verify(globalRms).getMetricsContext();
     verify(globalRms).getMetricsJmxContext();
     verify(globalRms).getMetricsName();
     verify(singleRms).incCounters(singleCounterName, count);
-    verify(globalRms).incCounters(counterName, count);
+    verify(globalRms).incCounters(globalCounterName, count);
     verify(singleRms).incGauge(singleGaugeName, delta);
-    verify(globalRms).incGauge(gaugeName, delta);
+    verify(globalRms).incGauge(globalGaugeName, delta);
     verify(globalRms).init();
     verify(singleRms).removeMetric(singleGaugeName);
-    verify(globalRms).removeMetric(gaugeName);
+    verify(globalRms).removeMetric(globalGaugeName);
     verify(singleRms).setGauge(singleGaugeName, delta);
-    verify(globalRms).setGauge(gaugeName, delta);
+    verify(globalRms).setGauge(globalGaugeName, delta);
     verify(singleRms).updateHistogram(singleCounterName, count);
-    verify(globalRms).updateHistogram(counterName, count);
+    verify(globalRms).updateHistogram(globalCounterName, count);
   }
 
   private void doPut(byte[] row) throws IOException {


Mime
View raw message