HBASE-2890 init per-method RPC metrics on startup

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@980638 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-07-30 03:22:08 +00:00
parent d4d88f1ce3
commit 26ebe0c583
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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 Updater {
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 Updater {
//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);