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
cc8e1cc393
commit
f94ad9d78f
|
@ -72,7 +72,13 @@ public interface MetricsHBaseServerSource extends ExceptionTrackingSource {
|
||||||
String NUM_OPEN_CONNECTIONS_NAME = "numOpenConnections";
|
String NUM_OPEN_CONNECTIONS_NAME = "numOpenConnections";
|
||||||
String NUM_OPEN_CONNECTIONS_DESC = "Number of open connections.";
|
String NUM_OPEN_CONNECTIONS_DESC = "Number of open connections.";
|
||||||
String NUM_ACTIVE_HANDLER_NAME = "numActiveHandler";
|
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_NAME = "numActiveWriteHandler";
|
||||||
String NUM_ACTIVE_WRITE_HANDLER_DESC = "Number of active write rpc handlers.";
|
String NUM_ACTIVE_WRITE_HANDLER_DESC = "Number of active write rpc handlers.";
|
||||||
String NUM_ACTIVE_READ_HANDLER_NAME = "numActiveReadHandler";
|
String NUM_ACTIVE_READ_HANDLER_NAME = "numActiveReadHandler";
|
||||||
|
|
|
@ -32,6 +32,12 @@ public interface MetricsHBaseServerWrapper {
|
||||||
|
|
||||||
int getActiveRpcHandlerCount();
|
int getActiveRpcHandlerCount();
|
||||||
|
|
||||||
|
int getActiveGeneralRpcHandlerCount();
|
||||||
|
|
||||||
|
int getActivePriorityRpcHandlerCount();
|
||||||
|
|
||||||
|
int getActiveReplicationRpcHandlerCount();
|
||||||
|
|
||||||
long getNumGeneralCallsDropped();
|
long getNumGeneralCallsDropped();
|
||||||
|
|
||||||
long getNumLifoModeSwitches();
|
long getNumLifoModeSwitches();
|
||||||
|
|
|
@ -155,6 +155,14 @@ public class MetricsHBaseServerSourceImpl extends ExceptionTrackingSourceImpl
|
||||||
NUM_OPEN_CONNECTIONS_DESC), wrapper.getNumOpenConnections())
|
NUM_OPEN_CONNECTIONS_DESC), wrapper.getNumOpenConnections())
|
||||||
.addGauge(Interns.info(NUM_ACTIVE_HANDLER_NAME,
|
.addGauge(Interns.info(NUM_ACTIVE_HANDLER_NAME,
|
||||||
NUM_ACTIVE_HANDLER_DESC), wrapper.getActiveRpcHandlerCount())
|
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,
|
.addCounter(Interns.info(NUM_GENERAL_CALLS_DROPPED_NAME,
|
||||||
NUM_GENERAL_CALLS_DROPPED_DESC), wrapper.getNumGeneralCallsDropped())
|
NUM_GENERAL_CALLS_DROPPED_DESC), wrapper.getNumGeneralCallsDropped())
|
||||||
.addCounter(Interns.info(NUM_LIFO_MODE_SWITCHES_NAME,
|
.addCounter(Interns.info(NUM_LIFO_MODE_SWITCHES_NAME,
|
||||||
|
|
|
@ -109,6 +109,21 @@ public class FifoRpcScheduler extends RpcScheduler {
|
||||||
return executor.getActiveCount();
|
return executor.getActiveCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActiveGeneralRpcHandlerCount() {
|
||||||
|
return getActiveRpcHandlerCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActivePriorityRpcHandlerCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActiveReplicationRpcHandlerCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getNumGeneralCallsDropped() {
|
public long getNumGeneralCallsDropped() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -79,6 +79,30 @@ public class MetricsHBaseServerWrapperImpl implements MetricsHBaseServerWrapper
|
||||||
return server.getScheduler().getActiveRpcHandlerCount();
|
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
|
@Override
|
||||||
public long getNumGeneralCallsDropped() {
|
public long getNumGeneralCallsDropped() {
|
||||||
if (!isServerStarted() || this.server.getScheduler() == null) {
|
if (!isServerStarted() || this.server.getScheduler() == null) {
|
||||||
|
|
|
@ -74,9 +74,18 @@ public abstract class RpcScheduler {
|
||||||
/** Retrieves length of the replication queue for metrics. */
|
/** Retrieves length of the replication queue for metrics. */
|
||||||
public abstract int getReplicationQueueLength();
|
public abstract int getReplicationQueueLength();
|
||||||
|
|
||||||
/** Retrieves the number of active handler. */
|
/** Retrieves the total number of active handler. */
|
||||||
public abstract int getActiveRpcHandlerCount();
|
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
|
* 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.
|
* from general queue because RPC executor is under high load; returns 0 otherwise.
|
||||||
|
|
|
@ -175,9 +175,23 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getActiveRpcHandlerCount() {
|
public int getActiveRpcHandlerCount() {
|
||||||
return callExecutor.getActiveHandlerCount() +
|
return callExecutor.getActiveHandlerCount() + getActivePriorityRpcHandlerCount()
|
||||||
(priorityExecutor == null ? 0 : priorityExecutor.getActiveHandlerCount()) +
|
+ getActiveReplicationRpcHandlerCount();
|
||||||
(replicationExecutor == null ? 0 : replicationExecutor.getActiveHandlerCount());
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
|
|
|
@ -59,6 +59,21 @@ public class DelegatingRpcScheduler extends RpcScheduler {
|
||||||
return delegate.getActiveRpcHandlerCount();
|
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
|
@Override
|
||||||
public boolean dispatch(CallRunner task) throws IOException, InterruptedException {
|
public boolean dispatch(CallRunner task) throws IOException, InterruptedException {
|
||||||
return delegate.dispatch(task);
|
return delegate.dispatch(task);
|
||||||
|
|
|
@ -49,6 +49,21 @@ public class MetricsHBaseServerWrapperStub implements MetricsHBaseServerWrapper{
|
||||||
return 106;
|
return 106;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActiveGeneralRpcHandlerCount() {
|
||||||
|
return 201;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActivePriorityRpcHandlerCount() {
|
||||||
|
return 202;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getActiveReplicationRpcHandlerCount() {
|
||||||
|
return 203;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getNumGeneralCallsDropped() {
|
public long getNumGeneralCallsDropped() {
|
||||||
return 3;
|
return 3;
|
||||||
|
|
|
@ -69,6 +69,9 @@ public class TestRpcMetrics {
|
||||||
HELPER.assertGauge("numCallsInPriorityQueue", 104, serverSource);
|
HELPER.assertGauge("numCallsInPriorityQueue", 104, serverSource);
|
||||||
HELPER.assertGauge("numOpenConnections", 105, serverSource);
|
HELPER.assertGauge("numOpenConnections", 105, serverSource);
|
||||||
HELPER.assertGauge("numActiveHandler", 106, 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("numActiveWriteHandler", 50, serverSource);
|
||||||
HELPER.assertGauge("numActiveReadHandler", 50, serverSource);
|
HELPER.assertGauge("numActiveReadHandler", 50, serverSource);
|
||||||
HELPER.assertGauge("numActiveScanHandler", 6, serverSource);
|
HELPER.assertGauge("numActiveScanHandler", 6, serverSource);
|
||||||
|
|
Loading…
Reference in New Issue