HBASE-14459 Add response and request size metrics
Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
a463984945
commit
76463a36f5
|
@ -38,6 +38,10 @@ public interface MetricsHBaseServerSource extends BaseSource {
|
|||
String SENT_BYTES_DESC = "Number of bytes sent.";
|
||||
String RECEIVED_BYTES_NAME = "receivedBytes";
|
||||
String RECEIVED_BYTES_DESC = "Number of bytes received.";
|
||||
String REQUEST_SIZE_NAME = "requestSize";
|
||||
String REQUEST_SIZE_DESC = "Request size in bytes.";
|
||||
String RESPONSE_SIZE_NAME = "responseSize";
|
||||
String RESPONSE_SIZE_DESC = "Response size in bytes.";
|
||||
String QUEUE_CALL_TIME_NAME = "queueCallTime";
|
||||
String QUEUE_CALL_TIME_DESC = "Queue Call Time.";
|
||||
String PROCESS_CALL_TIME_NAME = "processCallTime";
|
||||
|
@ -92,6 +96,10 @@ public interface MetricsHBaseServerSource extends BaseSource {
|
|||
|
||||
void receivedBytes(int count);
|
||||
|
||||
void sentResponse(long count);
|
||||
|
||||
void receivedRequest(long count);
|
||||
|
||||
void dequeuedCall(int qTime);
|
||||
|
||||
void processedCall(int processingTime);
|
||||
|
|
|
@ -51,6 +51,8 @@ public class MetricsHBaseServerSourceImpl extends BaseSourceImpl
|
|||
private MutableHistogram queueCallTime;
|
||||
private MutableHistogram processCallTime;
|
||||
private MutableHistogram totalCallTime;
|
||||
private MutableHistogram requestSize;
|
||||
private MutableHistogram responseSize;
|
||||
|
||||
public MetricsHBaseServerSourceImpl(String metricsName,
|
||||
String metricsDescription,
|
||||
|
@ -93,6 +95,10 @@ public class MetricsHBaseServerSourceImpl extends BaseSourceImpl
|
|||
PROCESS_CALL_TIME_DESC);
|
||||
this.totalCallTime = this.getMetricsRegistry().newHistogram(TOTAL_CALL_TIME_NAME,
|
||||
TOTAL_CALL_TIME_DESC);
|
||||
this.requestSize = this.getMetricsRegistry().newHistogram(REQUEST_SIZE_NAME,
|
||||
REQUEST_SIZE_DESC);
|
||||
this.responseSize = this.getMetricsRegistry().newHistogram(RESPONSE_SIZE_NAME,
|
||||
RESPONSE_SIZE_DESC);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,6 +166,12 @@ public class MetricsHBaseServerSourceImpl extends BaseSourceImpl
|
|||
this.receivedBytes.incr(count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sentResponse(long count) { this.responseSize.add(count); }
|
||||
|
||||
@Override
|
||||
public void receivedRequest(long count) { this.requestSize.add(count); }
|
||||
|
||||
@Override
|
||||
public void dequeuedCall(int qTime) {
|
||||
queueCallTime.add(qTime);
|
||||
|
|
|
@ -61,6 +61,10 @@ public class MetricsHBaseServer {
|
|||
source.receivedBytes(count);
|
||||
}
|
||||
|
||||
void sentResponse(long count) { source.sentResponse(count); }
|
||||
|
||||
void receivedRequest(long count) { source.receivedRequest(count); }
|
||||
|
||||
void dequeuedCall(int qTime) {
|
||||
source.dequeuedCall(qTime);
|
||||
}
|
||||
|
|
|
@ -2145,10 +2145,13 @@ public class RpcServer implements RpcServerInterface {
|
|||
" processingTime: " + processingTime +
|
||||
" totalTime: " + totalTime);
|
||||
}
|
||||
long requestSize = param.getSerializedSize();
|
||||
long responseSize = result.getSerializedSize();
|
||||
metrics.dequeuedCall(qTime);
|
||||
metrics.processedCall(processingTime);
|
||||
metrics.totalCall(totalTime);
|
||||
long responseSize = result.getSerializedSize();
|
||||
metrics.receivedRequest(requestSize);
|
||||
metrics.sentResponse(responseSize);
|
||||
// log any RPC responses that are slower than the configured warn
|
||||
// response time or larger than configured warning size
|
||||
boolean tooSlow = (processingTime > warnResponseTime && warnResponseTime > -1);
|
||||
|
|
|
@ -119,6 +119,11 @@ public class TestRpcMetrics {
|
|||
HELPER.assertCounter("sentBytes", 309, serverSource);
|
||||
HELPER.assertCounter("receivedBytes", 208, serverSource);
|
||||
|
||||
mrpc.receivedRequest(105);
|
||||
mrpc.sentResponse(106);
|
||||
HELPER.assertCounter("requestSize_NumOps", 1, serverSource);
|
||||
HELPER.assertCounter("responseSize_NumOps", 1, serverSource);
|
||||
|
||||
mrpc.exception(null);
|
||||
HELPER.assertCounter("exceptions", 1, serverSource);
|
||||
|
||||
|
|
Loading…
Reference in New Issue