HBASE-15163 Add sampling code and metrics for get/scan/multi/mutate count separately (Yu Li)
This commit is contained in:
parent
d82ae42126
commit
eacf7bcf97
|
@ -330,4 +330,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.";
|
||||
}
|
||||
|
|
|
@ -372,4 +372,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();
|
||||
}
|
||||
|
|
|
@ -205,6 +205,14 @@ public class MetricsRegionServerSourceImpl
|
|||
rsWrap.getFilteredReadRequestsCount())
|
||||
.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),
|
||||
|
|
|
@ -2331,6 +2331,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();
|
||||
|
|
|
@ -418,6 +418,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;
|
||||
|
|
|
@ -220,6 +220,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;
|
||||
|
@ -2091,6 +2104,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
try {
|
||||
checkOpen();
|
||||
requestCount.increment();
|
||||
rpcGetRequestCount.increment();
|
||||
Region region = getRegion(request.getRegion());
|
||||
|
||||
GetResponse.Builder builder = GetResponse.newBuilder();
|
||||
|
@ -2231,6 +2245,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
Boolean processed = null;
|
||||
RegionScannersCloseCallBack closeCallBack = null;
|
||||
RpcCallContext context = RpcServer.getCurrentCall();
|
||||
this.rpcMultiRequestCount.increment();
|
||||
for (RegionAction regionAction : request.getRegionActionList()) {
|
||||
this.requestCount.add(regionAction.getActionCount());
|
||||
OperationQuota quota;
|
||||
|
@ -2352,6 +2367,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();
|
||||
|
@ -2496,6 +2512,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
throw e;
|
||||
}
|
||||
requestCount.increment();
|
||||
rpcScanRequestCount.increment();
|
||||
|
||||
int ttl = 0;
|
||||
Region region = null;
|
||||
|
|
|
@ -95,6 +95,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