You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2010/07/30 05:22:09 UTC

svn commit: r980638 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java

Author: stack
Date: Fri Jul 30 03:22:08 2010
New Revision: 980638

URL: http://svn.apache.org/viewvc?rev=980638&view=rev
Log:
HBASE-2890 init per-method RPC metrics on startup

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=980638&r1=980637&r2=980638&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Jul 30 03:22:08 2010
@@ -460,6 +460,7 @@ Release 0.21.0 - Unreleased
    HBASE-2820  hbck throws an error if HBase root dir isn't on the default FS
    HBASE-2884  TestHFileOutputFormat flaky when map tasks generate identical
                data
+   HBASE-2890  init per-method RPC metrics on startup (Gary Helmling via Stack)
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java?rev=980638&r1=980637&r2=980638&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java Fri Jul 30 03:22:08 2010
@@ -29,6 +29,8 @@ import org.apache.hadoop.metrics.Updater
 import org.apache.hadoop.metrics.util.MetricsRegistry;
 import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate;
 
+import java.lang.reflect.Method;
+
 /**
  *
  * This class is for maintaining  the various RPC statistics
@@ -57,6 +59,9 @@ public class HBaseRpcMetrics implements 
 
     context.registerUpdater(this);
 
+    initMethods(HMasterInterface.class);
+    initMethods(HMasterRegionInterface.class);
+    initMethods(HRegionInterface.class);
     rpcStatistics = new HBaseRPCStatistics(this.registry, hostName, port);
   }
 
@@ -73,6 +78,12 @@ public class HBaseRpcMetrics implements 
 
   //public Map <String, MetricsTimeVaryingRate> metricsList = Collections.synchronizedMap(new HashMap<String, MetricsTimeVaryingRate>());
 
+  private void initMethods(Class<? extends HBaseRPCProtocolVersion> protocol) {
+    for (Method m : protocol.getDeclaredMethods()) {
+      if (get(m.getName()) == null)
+        create(m.getName());
+    }
+  }
 
   private MetricsTimeVaryingRate get(String key) {
     return (MetricsTimeVaryingRate) registry.get(key);