hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject svn commit: r1526310 - in /hbase/branches/0.96: hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/ hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/ hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/...
Date Wed, 25 Sep 2013 21:41:26 GMT
Author: eclark
Date: Wed Sep 25 21:41:25 2013
New Revision: 1526310

URL: http://svn.apache.org/r1526310
Log:
HBASE-9650 Per region metrics are not showing up for system tables.

Modified:
    hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java
    hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
    hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java
    hbase/branches/0.96/hbase-hadoop1-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
    hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
    hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java
    hbase/branches/0.96/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java
    hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperStub.java
    hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegion.java
    hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java

Modified: hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java
(original)
+++ hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java
Wed Sep 25 21:41:25 2013
@@ -32,6 +32,12 @@ public interface MetricsRegionWrapper {
   String getTableName();
 
   /**
+   * Get the name of the namespace this table is in.
+   * @return String version of the namespace.  Can't be empty.
+   */
+  String getNamespace();
+
+  /**
    * Get the name of the region.
    *
    * @return The encoded name of the region.

Modified: hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
(original)
+++ hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
Wed Sep 25 21:41:25 2013
@@ -24,7 +24,7 @@ import org.apache.hadoop.metrics2.Metric
 import org.apache.hadoop.metrics2.impl.JmxCacheBuster;
 import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry;
 import org.apache.hadoop.metrics2.lib.MetricMutableCounterLong;
-import org.apache.hadoop.metrics2.lib.MetricMutableStat;
+import org.apache.hadoop.metrics2.lib.MetricMutableHistogram;
 
 public class MetricsRegionSourceImpl implements MetricsRegionSource {
 
@@ -46,8 +46,8 @@ public class MetricsRegionSourceImpl imp
   private MetricMutableCounterLong regionIncrement;
   private MetricMutableCounterLong regionAppend;
 
-  private MetricMutableStat regionGet;
-  private MetricMutableStat regionScanNext;
+  private MetricMutableHistogram regionGet;
+  private MetricMutableHistogram regionScanNext;
 
   public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
                                  MetricsRegionAggregateSourceImpl aggregate) {
@@ -56,14 +56,14 @@ public class MetricsRegionSourceImpl imp
     agg.register(this);
 
     LOG.debug("Creating new MetricsRegionSourceImpl for table " +
-        regionWrapper.getTableName() +
-        " " +
-        regionWrapper.getRegionName());
+        regionWrapper.getTableName() + " " + regionWrapper.getRegionName());
 
     registry = agg.getMetricsRegistry();
 
-    regionNamePrefix = "table." + regionWrapper.getTableName() + "."
-        + "region." + regionWrapper.getRegionName() + ".";
+    regionNamePrefix = "namespace_" + regionWrapper.getNamespace() +
+        "_table_" + regionWrapper.getTableName() +
+        "_region_" + regionWrapper.getRegionName()  +
+        "_metric_";
 
     String suffix = "Count";
 
@@ -81,10 +81,10 @@ public class MetricsRegionSourceImpl imp
     regionAppend = registry.getLongCounter(regionAppendKey, 0l);
 
     regionGetKey = regionNamePrefix + MetricsRegionServerSource.GET_KEY;
-    regionGet = registry.newStat(regionGetKey, "", OPS_SAMPLE_NAME, SIZE_VALUE_NAME);
+    regionGet = registry.newHistogram(regionGetKey);
 
     regionScanNextKey = regionNamePrefix + MetricsRegionServerSource.SCAN_NEXT_KEY;
-    regionScanNext = registry.newStat(regionScanNextKey, "", OPS_SAMPLE_NAME, SIZE_VALUE_NAME);
+    regionScanNext = registry.newHistogram(regionScanNextKey);
   }
 
   @Override

Modified: hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java
(original)
+++ hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java
Wed Sep 25 21:41:25 2013
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.thrift;
 
 import org.apache.hadoop.hbase.metrics.BaseSourceImpl;
 import org.apache.hadoop.metrics2.lib.MetricMutableGaugeLong;
+import org.apache.hadoop.metrics2.lib.MetricMutableHistogram;
 import org.apache.hadoop.metrics2.lib.MetricMutableStat;
 
 /**
@@ -31,12 +32,12 @@ public class MetricsThriftServerSourceIm
     MetricsThriftServerSource {
 
 
-  private MetricMutableStat batchGetStat;
-  private MetricMutableStat batchMutateStat;
-  private MetricMutableStat queueTimeStat;
+  private MetricMutableHistogram batchGetStat;
+  private MetricMutableHistogram batchMutateStat;
+  private MetricMutableHistogram queueTimeStat;
 
-  private MetricMutableStat thriftCallStat;
-  private MetricMutableStat thriftSlowCallStat;
+  private MetricMutableHistogram thriftCallStat;
+  private MetricMutableHistogram thriftSlowCallStat;
 
   private MetricMutableGaugeLong callQueueLenGauge;
 
@@ -51,11 +52,11 @@ public class MetricsThriftServerSourceIm
   @Override
   public void init() {
     super.init();
-    batchGetStat = getMetricsRegistry().newStat(BATCH_GET_KEY, "", "Keys", "Ops");
-    batchMutateStat = getMetricsRegistry().newStat(BATCH_MUTATE_KEY, "", "Keys", "Ops");
-    queueTimeStat = getMetricsRegistry().newStat(TIME_IN_QUEUE_KEY);
-    thriftCallStat = getMetricsRegistry().newStat(THRIFT_CALL_KEY);
-    thriftSlowCallStat = getMetricsRegistry().newStat(SLOW_THRIFT_CALL_KEY);
+    batchGetStat = getMetricsRegistry().newHistogram(BATCH_GET_KEY);
+    batchMutateStat = getMetricsRegistry().newHistogram(BATCH_MUTATE_KEY);
+    queueTimeStat = getMetricsRegistry().newHistogram(TIME_IN_QUEUE_KEY);
+    thriftCallStat = getMetricsRegistry().newHistogram(THRIFT_CALL_KEY);
+    thriftSlowCallStat = getMetricsRegistry().newHistogram(SLOW_THRIFT_CALL_KEY);
     callQueueLenGauge = getMetricsRegistry().getLongGauge(CALL_QUEUE_LEN_KEY, 0);
   }
 
@@ -81,7 +82,7 @@ public class MetricsThriftServerSourceIm
 
   @Override
   public void incMethodTime(String name, long time) {
-    MetricMutableStat s = getMetricsRegistry().newStat(name);
+    MetricMutableHistogram s = getMetricsRegistry().getHistogram(name);
     s.add(time);
   }
 

Modified: hbase/branches/0.96/hbase-hadoop1-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop1-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop1-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
(original)
+++ hbase/branches/0.96/hbase-hadoop1-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
Wed Sep 25 21:41:25 2013
@@ -60,7 +60,12 @@ public class TestMetricsRegionSourceImpl
 
     @Override
     public String getTableName() {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
+      return null;
+    }
+
+    @Override
+    public String getNamespace() {
+      return null;
     }
 
     @Override
@@ -70,32 +75,32 @@ public class TestMetricsRegionSourceImpl
 
     @Override
     public long getNumStores() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getNumStoreFiles() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getMemstoreSize() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getStoreFileSize() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getReadRequestCount() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getWriteRequestCount() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
   }
 }

Modified: hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
(original)
+++ hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionSourceImpl.java
Wed Sep 25 21:41:25 2013
@@ -26,7 +26,7 @@ import org.apache.hadoop.metrics2.impl.J
 import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry;
 import org.apache.hadoop.metrics2.lib.Interns;
 import org.apache.hadoop.metrics2.lib.MutableCounterLong;
-import org.apache.hadoop.metrics2.lib.MutableStat;
+import org.apache.hadoop.metrics2.lib.MutableHistogram;
 
 @InterfaceAudience.Private
 public class MetricsRegionSourceImpl implements MetricsRegionSource {
@@ -52,8 +52,8 @@ public class MetricsRegionSourceImpl imp
   private MutableCounterLong regionIncrement;
   private MutableCounterLong regionAppend;
 
-  private MutableStat regionGet;
-  private MutableStat regionScanNext;
+  private MutableHistogram regionGet;
+  private MutableHistogram regionScanNext;
 
   public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
                                  MetricsRegionAggregateSourceImpl aggregate) {
@@ -62,14 +62,14 @@ public class MetricsRegionSourceImpl imp
     agg.register(this);
 
     LOG.debug("Creating new MetricsRegionSourceImpl for table " +
-        regionWrapper.getTableName() +
-        " " +
-        regionWrapper.getRegionName());
+        regionWrapper.getTableName() + " " + regionWrapper.getRegionName());
 
     registry = agg.getMetricsRegistry();
 
-    regionNamePrefix = "table." + regionWrapper.getTableName() + "."
-        + "region." + regionWrapper.getRegionName() + ".";
+    regionNamePrefix = "namespace_" + regionWrapper.getNamespace() +
+        "_table_" + regionWrapper.getTableName() +
+        "_region_" + regionWrapper.getRegionName()  +
+        "_metric_";
 
     String suffix = "Count";
 
@@ -86,10 +86,10 @@ public class MetricsRegionSourceImpl imp
     regionAppend = registry.getLongCounter(regionAppendKey, 0l);
 
     regionGetKey = regionNamePrefix + MetricsRegionServerSource.GET_KEY;
-    regionGet = registry.newStat(regionGetKey, "", OPS_SAMPLE_NAME, SIZE_VALUE_NAME);
+    regionGet = registry.newHistogram(regionGetKey);
 
     regionScanNextKey = regionNamePrefix + MetricsRegionServerSource.SCAN_NEXT_KEY;
-    regionScanNext = registry.newStat(regionScanNextKey, "", OPS_SAMPLE_NAME, SIZE_VALUE_NAME);
+    regionScanNext = registry.newHistogram(regionScanNextKey);
   }
 
   @Override

Modified: hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java
(original)
+++ hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceImpl.java
Wed Sep 25 21:41:25 2013
@@ -21,7 +21,7 @@ package org.apache.hadoop.hbase.thrift;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.metrics.BaseSourceImpl;
 import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
-import org.apache.hadoop.metrics2.lib.MutableStat;
+import org.apache.hadoop.metrics2.lib.MutableHistogram;
 
 /**
  * Hadoop 2 version of MetricsThriftServerSource{@link org.apache.hadoop.hbase.thrift.MetricsThriftServerSource}
@@ -32,12 +32,12 @@ import org.apache.hadoop.metrics2.lib.Mu
 public class MetricsThriftServerSourceImpl extends BaseSourceImpl implements
     MetricsThriftServerSource {
 
-  private MutableStat batchGetStat;
-  private MutableStat batchMutateStat;
-  private MutableStat queueTimeStat;
+  private MutableHistogram batchGetStat;
+  private MutableHistogram batchMutateStat;
+  private MutableHistogram queueTimeStat;
 
-  private MutableStat thriftCallStat;
-  private MutableStat thriftSlowCallStat;
+  private MutableHistogram thriftCallStat;
+  private MutableHistogram thriftSlowCallStat;
 
   private MutableGaugeLong callQueueLenGauge;
 
@@ -51,13 +51,11 @@ public class MetricsThriftServerSourceIm
   @Override
   public void init() {
     super.init();
-    batchGetStat = getMetricsRegistry().newStat(BATCH_GET_KEY, "", "Keys", "Ops");
-    batchMutateStat = getMetricsRegistry().newStat(BATCH_MUTATE_KEY, "", "Keys", "Ops");
-    queueTimeStat = getMetricsRegistry().newRate(TIME_IN_QUEUE_KEY);
-
-    thriftCallStat = getMetricsRegistry().newRate(THRIFT_CALL_KEY);
-    thriftSlowCallStat = getMetricsRegistry().newRate(SLOW_THRIFT_CALL_KEY);
-
+    batchGetStat = getMetricsRegistry().newHistogram(BATCH_GET_KEY);
+    batchMutateStat = getMetricsRegistry().newHistogram(BATCH_MUTATE_KEY);
+    queueTimeStat = getMetricsRegistry().newHistogram(TIME_IN_QUEUE_KEY);
+    thriftCallStat = getMetricsRegistry().newHistogram(THRIFT_CALL_KEY);
+    thriftSlowCallStat = getMetricsRegistry().newHistogram(SLOW_THRIFT_CALL_KEY);
     callQueueLenGauge = getMetricsRegistry().getLongGauge(CALL_QUEUE_LEN_KEY, 0);
 
   }
@@ -84,7 +82,7 @@ public class MetricsThriftServerSourceIm
 
   @Override
   public void incMethodTime(String name, long time) {
-    MutableStat s = getMetricsRegistry().newRate(name);
+    MutableHistogram s = getMetricsRegistry().getHistogram(name);
     s.add(time);
   }
 

Modified: hbase/branches/0.96/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
(original)
+++ hbase/branches/0.96/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
Wed Sep 25 21:41:25 2013
@@ -60,7 +60,12 @@ public class TestMetricsRegionSourceImpl
 
     @Override
     public String getTableName() {
-      return null;  //To change body of implemented methods use File | Settings | File Templates.
+      return null;
+    }
+
+    @Override
+    public String getNamespace() {
+      return null;
     }
 
     @Override
@@ -70,32 +75,32 @@ public class TestMetricsRegionSourceImpl
 
     @Override
     public long getNumStores() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getNumStoreFiles() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getMemstoreSize() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getStoreFileSize() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getReadRequestCount() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
 
     @Override
     public long getWriteRequestCount() {
-      return 0;  //To change body of implemented methods use File | Settings | File Templates.
+      return 0;
     }
   }
 }

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java
Wed Sep 25 21:41:25 2013
@@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit;
 public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable {
 
   public static final int PERIOD = 45;
+  public static final String UNKNOWN = "unknown";
 
   private final HRegion region;
   private ScheduledExecutorService executor;
@@ -55,16 +56,26 @@ public class MetricsRegionWrapperImpl im
   public String getTableName() {
     HTableDescriptor tableDesc = this.region.getTableDesc();
     if (tableDesc == null) {
-      return "";
+      return UNKNOWN;
     }
-    return tableDesc.getTableName().getNameAsString();
+    return tableDesc.getTableName().getQualifierAsString();
   }
 
   @Override
+  public String getNamespace() {
+    HTableDescriptor tableDesc = this.region.getTableDesc();
+    if (tableDesc == null) {
+      return UNKNOWN;
+    }
+    return tableDesc.getTableName().getNamespaceAsString();
+  }
+
+
+  @Override
   public String getRegionName() {
     HRegionInfo regionInfo = this.region.getRegionInfo();
     if (regionInfo == null) {
-      return "";
+      return UNKNOWN;
     }
     return regionInfo.getEncodedName();
   }

Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperStub.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperStub.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperStub.java
(original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperStub.java
Wed Sep 25 21:41:25 2013
@@ -26,6 +26,11 @@ public class MetricsRegionWrapperStub im
   }
 
   @Override
+  public String getNamespace() {
+    return "TestNS";
+  }
+
+  @Override
   public String getRegionName() {
     return "DEADBEEF001";
   }

Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegion.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegion.java
(original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegion.java
Wed Sep 25 21:41:25 2013
@@ -35,9 +35,9 @@ public class TestMetricsRegion {
     MetricsRegion mr = new MetricsRegion(new MetricsRegionWrapperStub());
     MetricsRegionAggregateSource agg = mr.getSource().getAggregateSource();
 
-    HELPER.assertGauge("table.MetricsRegionWrapperStub.region.DEADBEEF001.storeCount", 101,
agg);
-    HELPER.assertGauge("table.MetricsRegionWrapperStub.region.DEADBEEF001.storeFileCount",
102, agg);
-    HELPER.assertGauge("table.MetricsRegionWrapperStub.region.DEADBEEF001.memstoreSize",
103, agg);
+    HELPER.assertGauge("namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_storeCount",
101, agg);
+    HELPER.assertGauge("namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_storeFileCount",
102, agg);
+    HELPER.assertGauge("namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_memstoreSize",
103, agg);
     mr.close();
   }
 }

Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java?rev=1526310&r1=1526309&r2=1526310&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java
(original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java
Wed Sep 25 21:41:25 2013
@@ -141,9 +141,12 @@ public class TestRegionServerMetrics {
           .getMetrics()
           .getSource()
           .getAggregateSource();
-      String prefix = "table."+tableNameString + ".region." + i.getEncodedName();
-      metricsHelper.assertCounter(prefix + ".getNumOps", 10, agg);
-      metricsHelper.assertCounter(prefix + ".mutateCount", 30, agg);
+      String prefix = "namespace_"+NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR+
+          "_table_"+tableNameString +
+          "_region_" + i.getEncodedName()+
+          "_metric";
+      metricsHelper.assertCounter(prefix + "_getNumOps", 10, agg);
+      metricsHelper.assertCounter(prefix + "_mutateCount", 30, agg);
     }
 
 
@@ -347,8 +350,11 @@ public class TestRegionServerMetrics {
           .getMetrics()
           .getSource()
           .getAggregateSource();
-      String prefix = "table."+tableNameString + ".region." + i.getEncodedName();
-      metricsHelper.assertCounter(prefix + ".scanNextNumOps", 30, agg);
+      String prefix = "namespace_"+NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR+
+          "_table_"+tableNameString +
+          "_region_" + i.getEncodedName()+
+          "_metric";
+      metricsHelper.assertCounter(prefix + "_scanNextNumOps", 30, agg);
     }
   }
 }



Mime
View raw message