HBASE-20450 Provide metrics for number of total active, priority and replication rpc handlers
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
273d252838
commit
758f4296a4
|
@ -76,7 +76,13 @@ public interface MetricsHBaseServerSource extends ExceptionTrackingSource {
|
|||
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.";
|
||||
String NUM_ACTIVE_HANDLER_DESC = "Total number of active rpc handlers.";
|
||||
String NUM_ACTIVE_GENERAL_HANDLER_NAME = "numActiveGeneralHandler";
|
||||
String NUM_ACTIVE_GENERAL_HANDLER_DESC = "Number of active general rpc handlers.";
|
||||
String NUM_ACTIVE_PRIORITY_HANDLER_NAME = "numActivePriorityHandler";
|
||||
String NUM_ACTIVE_PRIORITY_HANDLER_DESC = "Number of active priority rpc handlers.";
|
||||
String NUM_ACTIVE_REPLICATION_HANDLER_NAME = "numActiveReplicationHandler";
|
||||
String NUM_ACTIVE_REPLICATION_HANDLER_DESC = "Number of active replication rpc handlers.";
|
||||
String NUM_ACTIVE_WRITE_HANDLER_NAME = "numActiveWriteHandler";
|
||||
String NUM_ACTIVE_WRITE_HANDLER_DESC = "Number of active write rpc handlers.";
|
||||
String NUM_ACTIVE_READ_HANDLER_NAME = "numActiveReadHandler";
|
||||
|
|
|
@ -35,6 +35,12 @@ public interface MetricsHBaseServerWrapper {
|
|||
|
||||
int getActiveRpcHandlerCount();
|
||||
|
||||
int getActiveGeneralRpcHandlerCount();
|
||||
|
||||
int getActivePriorityRpcHandlerCount();
|
||||
|
||||
int getActiveReplicationRpcHandlerCount();
|
||||
|
||||
long getNumGeneralCallsDropped();
|
||||
|
||||
long getNumLifoModeSwitches();
|
||||
|
|
|
@ -155,6 +155,14 @@ public class MetricsHBaseServerSourceImpl extends ExceptionTrackingSourceImpl
|
|||
NUM_OPEN_CONNECTIONS_DESC), wrapper.getNumOpenConnections())
|
||||
.addGauge(Interns.info(NUM_ACTIVE_HANDLER_NAME,
|
||||
NUM_ACTIVE_HANDLER_DESC), wrapper.getActiveRpcHandlerCount())
|
||||
.addGauge(Interns.info(NUM_ACTIVE_GENERAL_HANDLER_NAME, NUM_ACTIVE_GENERAL_HANDLER_DESC),
|
||||
wrapper.getActiveGeneralRpcHandlerCount())
|
||||
.addGauge(
|
||||
Interns.info(NUM_ACTIVE_PRIORITY_HANDLER_NAME, NUM_ACTIVE_PRIORITY_HANDLER_DESC),
|
||||
wrapper.getActivePriorityRpcHandlerCount())
|
||||
.addGauge(
|
||||
Interns.info(NUM_ACTIVE_REPLICATION_HANDLER_NAME, NUM_ACTIVE_REPLICATION_HANDLER_DESC),
|
||||
wrapper.getActiveReplicationRpcHandlerCount())
|
||||
.addCounter(Interns.info(NUM_GENERAL_CALLS_DROPPED_NAME,
|
||||
NUM_GENERAL_CALLS_DROPPED_DESC), wrapper.getNumGeneralCallsDropped())
|
||||
.addCounter(Interns.info(NUM_LIFO_MODE_SWITCHES_NAME,
|
||||
|
|
|
@ -133,6 +133,21 @@ public class FifoRpcScheduler extends RpcScheduler {
|
|||
return executor.getActiveCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveGeneralRpcHandlerCount() {
|
||||
return getActiveRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActivePriorityRpcHandlerCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveReplicationRpcHandlerCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNumGeneralCallsDropped() {
|
||||
return 0;
|
||||
|
@ -204,5 +219,4 @@ public class FifoRpcScheduler extends RpcScheduler {
|
|||
|
||||
return callQueueInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,6 +82,30 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
|
|||
return server.getScheduler().getActiveRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveGeneralRpcHandlerCount() {
|
||||
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||
return 0;
|
||||
}
|
||||
return server.getScheduler().getActiveGeneralRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActivePriorityRpcHandlerCount() {
|
||||
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||
return 0;
|
||||
}
|
||||
return server.getScheduler().getActivePriorityRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveReplicationRpcHandlerCount() {
|
||||
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||
return 0;
|
||||
}
|
||||
return server.getScheduler().getActiveReplicationRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNumGeneralCallsDropped() {
|
||||
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||
|
|
|
@ -77,9 +77,18 @@ public abstract class RpcScheduler {
|
|||
/** Retrieves length of the replication queue for metrics. */
|
||||
public abstract int getReplicationQueueLength();
|
||||
|
||||
/** Retrieves the number of active handler. */
|
||||
/** Retrieves the total number of active handler. */
|
||||
public abstract int getActiveRpcHandlerCount();
|
||||
|
||||
/** Retrieves the number of active general handler. */
|
||||
public abstract int getActiveGeneralRpcHandlerCount();
|
||||
|
||||
/** Retrieves the number of active priority handler. */
|
||||
public abstract int getActivePriorityRpcHandlerCount();
|
||||
|
||||
/** Retrieves the number of active replication handler. */
|
||||
public abstract int getActiveReplicationRpcHandlerCount();
|
||||
|
||||
/**
|
||||
* If CoDel-based RPC executors are used, retrieves the number of Calls that were dropped
|
||||
* from general queue because RPC executor is under high load; returns 0 otherwise.
|
||||
|
|
|
@ -185,9 +185,23 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs
|
|||
|
||||
@Override
|
||||
public int getActiveRpcHandlerCount() {
|
||||
return callExecutor.getActiveHandlerCount() +
|
||||
(priorityExecutor == null ? 0 : priorityExecutor.getActiveHandlerCount()) +
|
||||
(replicationExecutor == null ? 0 : replicationExecutor.getActiveHandlerCount());
|
||||
return callExecutor.getActiveHandlerCount() + getActivePriorityRpcHandlerCount()
|
||||
+ getActiveReplicationRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveGeneralRpcHandlerCount() {
|
||||
return callExecutor.getActiveHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActivePriorityRpcHandlerCount() {
|
||||
return (priorityExecutor == null ? 0 : priorityExecutor.getActiveHandlerCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveReplicationRpcHandlerCount() {
|
||||
return (replicationExecutor == null ? 0 : replicationExecutor.getActiveHandlerCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,6 +59,21 @@ public class DelegatingRpcScheduler extends RpcScheduler {
|
|||
return delegate.getActiveRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveGeneralRpcHandlerCount() {
|
||||
return delegate.getActiveGeneralRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActivePriorityRpcHandlerCount() {
|
||||
return delegate.getActivePriorityRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveReplicationRpcHandlerCount() {
|
||||
return delegate.getActiveReplicationRpcHandlerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatch(CallRunner task) throws IOException, InterruptedException {
|
||||
return delegate.dispatch(task);
|
||||
|
|
|
@ -49,6 +49,21 @@ public class MetricsHBaseServerWrapperStub implements MetricsHBaseServerWrapper{
|
|||
return 106;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveGeneralRpcHandlerCount() {
|
||||
return 201;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActivePriorityRpcHandlerCount() {
|
||||
return 202;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveReplicationRpcHandlerCount() {
|
||||
return 203;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNumGeneralCallsDropped() {
|
||||
return 3;
|
||||
|
|
|
@ -74,6 +74,9 @@ public class TestRpcMetrics {
|
|||
HELPER.assertGauge("numCallsInPriorityQueue", 104, serverSource);
|
||||
HELPER.assertGauge("numOpenConnections", 105, serverSource);
|
||||
HELPER.assertGauge("numActiveHandler", 106, serverSource);
|
||||
HELPER.assertGauge("numActiveGeneralHandler", 201, serverSource);
|
||||
HELPER.assertGauge("numActivePriorityHandler", 202, serverSource);
|
||||
HELPER.assertGauge("numActiveReplicationHandler", 203, serverSource);
|
||||
HELPER.assertGauge("numActiveWriteHandler", 50, serverSource);
|
||||
HELPER.assertGauge("numActiveReadHandler", 50, serverSource);
|
||||
HELPER.assertGauge("numActiveScanHandler", 6, serverSource);
|
||||
|
|
Loading…
Reference in New Issue