hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/4] hbase git commit: HBASE-14459 Add response and request size metrics
Date Thu, 01 Oct 2015 02:15:40 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 4e1652542 -> 0bec6ea18
  refs/heads/branch-1 cca2ba4d9 -> d047c3787
  refs/heads/branch-1.2 54b64871f -> 26eea98a8
  refs/heads/master a46398494 -> 76463a36f


HBASE-14459 Add response and request size metrics

Signed-off-by: Andrew Purtell <apurtell@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/76463a36
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/76463a36
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/76463a36

Branch: refs/heads/master
Commit: 76463a36f5648f42cdcf64019a825c1e3f0c4fe1
Parents: a463984
Author: Sanjeev Srivatsa <ssrivatsa@fb.com>
Authored: Mon Sep 21 17:55:47 2015 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Wed Sep 30 18:22:48 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/ipc/MetricsHBaseServerSource.java      |  8 ++++++++
 .../hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java  | 12 ++++++++++++
 .../org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java |  4 ++++
 .../java/org/apache/hadoop/hbase/ipc/RpcServer.java     |  5 ++++-
 .../org/apache/hadoop/hbase/ipc/TestRpcMetrics.java     |  5 +++++
 5 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/76463a36/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
index 482fdba..36bd643 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
@@ -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);

http://git-wip-us.apache.org/repos/asf/hbase/blob/76463a36/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
index dadf9de..fe84733 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
@@ -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
@@ -161,6 +167,12 @@ public class MetricsHBaseServerSourceImpl extends BaseSourceImpl
   }
 
   @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);
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/76463a36/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
index 3ca50ad..ceef0df 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java
@@ -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);
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/76463a36/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
index 16bea72..6d9d6cd 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
@@ -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);

http://git-wip-us.apache.org/repos/asf/hbase/blob/76463a36/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
index 6bb97fd..9f1b63a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
@@ -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);
 


Mime
View raw message