hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-8725 Add total time RPC call metrics
Date Thu, 26 Mar 2015 18:27:04 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 69f6a2e7b -> 18256fc95


HBASE-8725 Add total time RPC call metrics

Signed-off-by: Elliott Clark <eclark@apache.org>


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

Branch: refs/heads/master
Commit: 18256fc9544866fc7182dfc5dd9d73b8cef02d66
Parents: 69f6a2e
Author: nke <nke@fb.com>
Authored: Wed Mar 25 17:21:01 2015 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Thu Mar 26 11:11:53 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java    | 6 +++++-
 .../hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java       | 8 ++++++++
 .../java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java | 4 ++++
 .../src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java | 8 ++++++--
 .../java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java     | 2 ++
 5 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/18256fc9/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 25f0c40..1f4c950 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
@@ -42,6 +42,8 @@ public interface MetricsHBaseServerSource extends BaseSource {
   String QUEUE_CALL_TIME_DESC = "Queue Call Time.";
   String PROCESS_CALL_TIME_NAME = "processCallTime";
   String PROCESS_CALL_TIME_DESC = "Processing call time.";
+  String TOTAL_CALL_TIME_NAME = "totalCallTime";
+  String TOTAL_CALL_TIME_DESC = "Total call time, including both queued and processing time.";
   String QUEUE_SIZE_NAME = "queueSize";
   String QUEUE_SIZE_DESC = "Number of bytes in the call queues.";
   String GENERAL_QUEUE_NAME = "numCallsInGeneralQueue";
@@ -71,4 +73,6 @@ public interface MetricsHBaseServerSource extends BaseSource {
   void dequeuedCall(int qTime);
 
   void processedCall(int processingTime);
-}
+
+  void queuedAndProcessedCall(int totalTime);
+  }

http://git-wip-us.apache.org/repos/asf/hbase/blob/18256fc9/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 04cf953..8eefb08 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
@@ -40,6 +40,7 @@ public class MetricsHBaseServerSourceImpl extends BaseSourceImpl
   private final MutableCounterLong receivedBytes;
   private MutableHistogram queueCallTime;
   private MutableHistogram processCallTime;
+  private MutableHistogram totalCallTime;
 
   public MetricsHBaseServerSourceImpl(String metricsName,
                                       String metricsDescription,
@@ -66,6 +67,8 @@ public class MetricsHBaseServerSourceImpl extends BaseSourceImpl
         QUEUE_CALL_TIME_DESC);
     this.processCallTime = this.getMetricsRegistry().newHistogram(PROCESS_CALL_TIME_NAME,
         PROCESS_CALL_TIME_DESC);
+    this.totalCallTime = this.getMetricsRegistry().newHistogram(TOTAL_CALL_TIME_NAME,
+        TOTAL_CALL_TIME_DESC);
   }
 
   @Override
@@ -109,6 +112,11 @@ public class MetricsHBaseServerSourceImpl extends BaseSourceImpl
   }
 
   @Override
+  public void queuedAndProcessedCall(int totalTime) {
+    totalCallTime.add(totalTime);
+  }
+
+  @Override
   public void getMetrics(MetricsCollector metricsCollector, boolean all) {
     MetricsRecordBuilder mrb = metricsCollector.addRecord(metricsName);
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/18256fc9/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 8ca8659..825e688 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
@@ -63,6 +63,10 @@ public class MetricsHBaseServer {
     source.processedCall(processingTime);
   }
 
+  void totalCall(int totalTime) {
+    source.queuedAndProcessedCall(totalTime);
+  }
+
   public MetricsHBaseServerSource getMetricsSource() {
     return source;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/18256fc9/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 8f4bbf9..07921db 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
@@ -2071,16 +2071,20 @@ public class RpcServer implements RpcServerInterface {
       long startTime = System.currentTimeMillis();
       PayloadCarryingRpcController controller = new PayloadCarryingRpcController(cellScanner);
       Message result = service.callBlockingMethod(md, controller, param);
-      int processingTime = (int) (System.currentTimeMillis() - startTime);
+      long endTime = System.currentTimeMillis();
+      int processingTime = (int) (endTime - startTime);
       int qTime = (int) (startTime - receiveTime);
+      int totalTime = (int) (endTime - receiveTime);
       if (LOG.isTraceEnabled()) {
         LOG.trace(CurCall.get().toString() +
             ", response " + TextFormat.shortDebugString(result) +
             " queueTime: " + qTime +
-            " processingTime: " + processingTime);
+            " processingTime: " + processingTime +
+            " totalTime: " + totalTime);
       }
       metrics.dequeuedCall(qTime);
       metrics.processedCall(processingTime);
+      metrics.totalCall(totalTime);
       long responseSize = result.getSerializedSize();
       // log any RPC responses that are slower than the configured warn
       // response time or larger than configured warning size

http://git-wip-us.apache.org/repos/asf/hbase/blob/18256fc9/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 443ec78..c2b0344 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
@@ -99,8 +99,10 @@ public class TestRpcMetrics {
 
     mrpc.dequeuedCall(100);
     mrpc.processedCall(101);
+    mrpc.totalCall(102);
     HELPER.assertCounter("queueCallTime_NumOps", 1, serverSource);
     HELPER.assertCounter("processCallTime_NumOps", 1, serverSource);
+    HELPER.assertCounter("totalCallTime_NumOps", 1, serverSource);
 
     mrpc.sentBytes(103);
     mrpc.sentBytes(103);


Mime
View raw message