HBASE-2146 RPC related metrics are missing in 0.20.3 since recent changes (Gary Helmling via Lars George)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@901402 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a8092ffc36
commit
3d51be2965
|
@ -180,6 +180,8 @@ Release 0.21.0 - Unreleased
|
|||
HBASE-2139 findbugs task in build.xml (Kay Kay via Stack)
|
||||
HBASE-2147 run zookeeper in the same jvm as master during non-distributed mode
|
||||
HBASE-1360 move up to Thrift 0.2.0 (Kay Kay and Lars Francke via Stack)
|
||||
HBASE-2146 RPC related metrics are missing in 0.20.3 since recent changes
|
||||
(Gary Helmling via Lars George)
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1760 Cleanup TODOs in HTable
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.net.InetSocketAddress;
|
|||
import java.net.SocketTimeoutException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -115,6 +116,10 @@ public class HBaseRPC {
|
|||
return localCode;
|
||||
}
|
||||
|
||||
static Collection<String> getMappedMethodNames() {
|
||||
return Invocation.CODE_TO_METHODNAME.values();
|
||||
}
|
||||
|
||||
static {
|
||||
code = HBaseRPC.addToMap(VersionedProtocol.class, code);
|
||||
code = HBaseRPC.addToMap(HMasterInterface.class, code);
|
||||
|
@ -656,8 +661,6 @@ public class HBaseRPC {
|
|||
LOG.debug("Served: " + call.getMethodName() +
|
||||
" queueTime= " + qTime +
|
||||
" procesingTime= " + processingTime);
|
||||
rpcMetrics.rpcQueueTime.inc(qTime);
|
||||
rpcMetrics.rpcProcessingTime.inc(processingTime);
|
||||
}
|
||||
rpcMetrics.rpcQueueTime.inc(qTime);
|
||||
rpcMetrics.rpcProcessingTime.inc(processingTime);
|
||||
|
|
|
@ -54,6 +54,7 @@ public class HBaseRpcMetrics implements Updater {
|
|||
|
||||
context.registerUpdater(this);
|
||||
|
||||
this.initMethods();
|
||||
rpcStatistics = new HBaseRPCStatistics(this.registry, hostName, port);
|
||||
}
|
||||
|
||||
|
@ -70,6 +71,17 @@ public class HBaseRpcMetrics implements Updater {
|
|||
|
||||
//public Map <String, MetricsTimeVaryingRate> metricsList = Collections.synchronizedMap(new HashMap<String, MetricsTimeVaryingRate>());
|
||||
|
||||
/**
|
||||
* Register metrics for all know RPC methods ahead of time. This helps with
|
||||
* JMX usage, where trying to retrieve the RPC-method metrics before they're
|
||||
* incremented could otherwise cause spurious AttributeNotFoundExceptions.
|
||||
*/
|
||||
private void initMethods() {
|
||||
for (String name : HBaseRPC.getMappedMethodNames()) {
|
||||
create(name);
|
||||
}
|
||||
}
|
||||
|
||||
private MetricsTimeVaryingRate get(String key) {
|
||||
return (MetricsTimeVaryingRate) registry.get(key);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue