HBASE-15163 Add sampling code and metrics for get/scan/multi/mutate count separately (Yu Li)
This commit is contained in:
parent
bd4a4ecf5e
commit
0649755d34
|
@ -289,4 +289,16 @@ public interface MetricsRegionServerSource extends BaseSource {
|
|||
String SPLIT_SUCCESS_KEY = "splitSuccessCount";
|
||||
String SPLIT_SUCCESS_DESC = "Number of successfully executed splits";
|
||||
String FLUSH_KEY = "flushTime";
|
||||
|
||||
String RPC_GET_REQUEST_COUNT = "rpcGetRequestCount";
|
||||
String RPC_GET_REQUEST_COUNT_DESC = "Number of rpc get requests this region server has answered.";
|
||||
String RPC_SCAN_REQUEST_COUNT = "rpcScanRequestCount";
|
||||
String RPC_SCAN_REQUEST_COUNT_DESC =
|
||||
"Number of rpc scan requests this region server has answered.";
|
||||
String RPC_MULTI_REQUEST_COUNT = "rpcMultiRequestCount";
|
||||
String RPC_MULTI_REQUEST_COUNT_DESC =
|
||||
"Number of rpc multi requests this region server has answered.";
|
||||
String RPC_MUTATE_REQUEST_COUNT = "rpcMutateRequestCount";
|
||||
String RPC_MUTATE_REQUEST_COUNT_DESC =
|
||||
"Number of rpc mutation requests this region server has answered.";
|
||||
}
|
||||
|
|
|
@ -282,4 +282,24 @@ public interface MetricsRegionServerWrapper {
|
|||
* @return Count of requests blocked because the memstore size is larger than blockingMemStoreSize
|
||||
*/
|
||||
long getBlockedRequestsCount();
|
||||
|
||||
/**
|
||||
* Get the number of rpc get requests to this region server.
|
||||
*/
|
||||
long getRpcGetRequestsCount();
|
||||
|
||||
/**
|
||||
* Get the number of rpc scan requests to this region server.
|
||||
*/
|
||||
long getRpcScanRequestsCount();
|
||||
|
||||
/**
|
||||
* Get the number of rpc multi requests to this region server.
|
||||
*/
|
||||
long getRpcMultiRequestsCount();
|
||||
|
||||
/**
|
||||
* Get the number of rpc mutate requests to this region server.
|
||||
*/
|
||||
long getRpcMutateRequestsCount();
|
||||
}
|
||||
|
|
|
@ -203,6 +203,14 @@ public class MetricsRegionServerSourceImpl
|
|||
rsWrap.getReadRequestsCount())
|
||||
.addCounter(Interns.info(WRITE_REQUEST_COUNT, WRITE_REQUEST_COUNT_DESC),
|
||||
rsWrap.getWriteRequestsCount())
|
||||
.addCounter(Interns.info(RPC_GET_REQUEST_COUNT, RPC_GET_REQUEST_COUNT_DESC),
|
||||
rsWrap.getRpcGetRequestsCount())
|
||||
.addCounter(Interns.info(RPC_SCAN_REQUEST_COUNT, RPC_SCAN_REQUEST_COUNT_DESC),
|
||||
rsWrap.getRpcScanRequestsCount())
|
||||
.addCounter(Interns.info(RPC_MULTI_REQUEST_COUNT, RPC_MULTI_REQUEST_COUNT_DESC),
|
||||
rsWrap.getRpcMultiRequestsCount())
|
||||
.addCounter(Interns.info(RPC_MUTATE_REQUEST_COUNT, RPC_MUTATE_REQUEST_COUNT_DESC),
|
||||
rsWrap.getRpcMutateRequestsCount())
|
||||
.addCounter(Interns.info(CHECK_MUTATE_FAILED_COUNT, CHECK_MUTATE_FAILED_COUNT_DESC),
|
||||
rsWrap.getCheckAndMutateChecksFailed())
|
||||
.addCounter(Interns.info(CHECK_MUTATE_PASSED_COUNT, CHECK_MUTATE_PASSED_COUNT_DESC),
|
||||
|
|
|
@ -2296,6 +2296,10 @@ public class HRegionServer extends HasThread implements
|
|||
RegionServerStartupResponse result = null;
|
||||
try {
|
||||
rpcServices.requestCount.set(0);
|
||||
rpcServices.rpcGetRequestCount.set(0);
|
||||
rpcServices.rpcScanRequestCount.set(0);
|
||||
rpcServices.rpcMultiRequestCount.set(0);
|
||||
rpcServices.rpcMutateRequestCount.set(0);
|
||||
LOG.info("reportForDuty to master=" + masterServerName + " with port="
|
||||
+ rpcServices.isa.getPort() + ", startcode=" + this.startcode);
|
||||
long now = EnvironmentEdgeManager.currentTime();
|
||||
|
|
|
@ -363,6 +363,26 @@ class MetricsRegionServerWrapperImpl
|
|||
return writeRequestsCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcGetRequestsCount() {
|
||||
return regionServer.rpcServices.rpcGetRequestCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcScanRequestsCount() {
|
||||
return regionServer.rpcServices.rpcScanRequestCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcMultiRequestsCount() {
|
||||
return regionServer.rpcServices.rpcMultiRequestCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcMutateRequestsCount() {
|
||||
return regionServer.rpcServices.rpcMutateRequestCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCheckAndMutateChecksFailed() {
|
||||
return checkAndMutateChecksFailed;
|
||||
|
|
|
@ -218,6 +218,19 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
|
||||
// Request counter. (Includes requests that are not serviced by regions.)
|
||||
final Counter requestCount = new Counter();
|
||||
|
||||
// Request counter for rpc get
|
||||
final Counter rpcGetRequestCount = new Counter();
|
||||
|
||||
// Request counter for rpc scan
|
||||
final Counter rpcScanRequestCount = new Counter();
|
||||
|
||||
// Request counter for rpc multi
|
||||
final Counter rpcMultiRequestCount = new Counter();
|
||||
|
||||
// Request counter for rpc mutate
|
||||
final Counter rpcMutateRequestCount = new Counter();
|
||||
|
||||
// Server to handle client requests.
|
||||
final RpcServerInterface rpcServer;
|
||||
final InetSocketAddress isa;
|
||||
|
@ -2020,6 +2033,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
try {
|
||||
checkOpen();
|
||||
requestCount.increment();
|
||||
rpcGetRequestCount.increment();
|
||||
Region region = getRegion(request.getRegion());
|
||||
|
||||
GetResponse.Builder builder = GetResponse.newBuilder();
|
||||
|
@ -2119,6 +2133,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
RegionActionResult.Builder regionActionResultBuilder = RegionActionResult.newBuilder();
|
||||
Boolean processed = null;
|
||||
|
||||
RpcCallContext context = RpcServer.getCurrentCall();
|
||||
this.rpcMultiRequestCount.increment();
|
||||
for (RegionAction regionAction : request.getRegionActionList()) {
|
||||
this.requestCount.add(regionAction.getActionCount());
|
||||
OperationQuota quota;
|
||||
|
@ -2233,6 +2249,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
try {
|
||||
checkOpen();
|
||||
requestCount.increment();
|
||||
rpcMutateRequestCount.increment();
|
||||
Region region = getRegion(request.getRegion());
|
||||
MutateResponse.Builder builder = MutateResponse.newBuilder();
|
||||
MutationProto mutation = request.getMutation();
|
||||
|
@ -2374,6 +2391,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
throw e;
|
||||
}
|
||||
requestCount.increment();
|
||||
rpcScanRequestCount.increment();
|
||||
|
||||
int ttl = 0;
|
||||
Region region = null;
|
||||
|
|
|
@ -90,6 +90,26 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
|
|||
return 707;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcGetRequestsCount() {
|
||||
return 521;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcScanRequestsCount() {
|
||||
return 101;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcMultiRequestsCount() {
|
||||
return 486;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcMutateRequestsCount() {
|
||||
return 606;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCheckAndMutateChecksFailed() {
|
||||
return 401;
|
||||
|
|
Loading…
Reference in New Issue