Amend HBASE-10561 Forward port: HBASE-10212 New rpc metric: number of active handler

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1594126 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
liangxie 2014-05-13 05:06:14 +00:00
parent 5be2766ef4
commit e1d16e9892
5 changed files with 8 additions and 3 deletions

View File

@ -53,6 +53,8 @@ public interface MetricsHBaseServerSource extends BaseSource {
String PRIORITY_QUEUE_DESC = "Number of calls in the priority call queue.";
String NUM_OPEN_CONNECTIONS_NAME = "numOpenConnections";
String NUM_OPEN_CONNECTIONS_DESC = "Number of open connections.";
String NUM_ACTIVE_HANDLER_NAME = "numActiveHandler";
String NUM_ACTIVE_HANDLER_DESC = "Number of active rpc handlers.";
void authorizationSuccess();

View File

@ -122,7 +122,9 @@ public class MetricsHBaseServerSourceImpl extends BaseSourceImpl
.addGauge(Interns.info(PRIORITY_QUEUE_NAME, PRIORITY_QUEUE_DESC),
wrapper.getPriorityQueueLength())
.addGauge(Interns.info(NUM_OPEN_CONNECTIONS_NAME,
NUM_OPEN_CONNECTIONS_DESC), wrapper.getNumOpenConnections());
NUM_OPEN_CONNECTIONS_DESC), wrapper.getNumOpenConnections())
.addGauge(Interns.info(NUM_ACTIVE_HANDLER_NAME,
NUM_ACTIVE_HANDLER_DESC), wrapper.getActiveRpcHandlerCount());
}
metricsRegistry.snapshot(mrb, all);

View File

@ -207,7 +207,7 @@ public class SimpleRpcScheduler implements RpcScheduler {
@Override
public int getActiveRpcHandlerCount() {
return 0;
return activeHandlerCount.get();
}
private void consumerLoop(BlockingQueue<CallRunner> myQueue) {

View File

@ -46,6 +46,6 @@ public class MetricsHBaseServerWrapperStub implements MetricsHBaseServerWrapper{
@Override
public int getActiveRpcHandlerCount() {
return 100;
return 106;
}
}

View File

@ -64,6 +64,7 @@ public class TestRpcMetrics {
HELPER.assertGauge("numCallsInReplicationQueue", 103, serverSource);
HELPER.assertGauge("numCallsInPriorityQueue", 104, serverSource);
HELPER.assertGauge("numOpenConnections", 105, serverSource);
HELPER.assertGauge("numActiveHandler", 106, serverSource);
}
/**