[ 
https://issues.apache.org/jira/browse/HBASE-16686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15524367#comment-15524367
 ] 

Andrew Purtell commented on HBASE-16686:
----------------------------------------

Convention across the code base is to use EnvironmentEdgeManager#getTime() 
instead of System#currentTimeMillis so the time can be controlled in unit tests:

{code}
@@ -72,6 +73,7 @@ public class MultiRowResource extends ResourceBase implements 
Constants {
     MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
 
     servlet.getMetrics().incrementRequests(1);
+    final long startTime = System.currentTimeMillis();
     try {
       CellSetModel model = new CellSetModel();
       for (String rk : params.get(ROW_KEYS_PARAM_NAME)) {
{code}

While a simple count of exceptions could be useful, does it make sense to break 
down the counts for common exceptions of interest? I would think so:
{code}
diff --git 
a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceBase.java 
b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceBase.java
index f71d848..f2a6c46 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceBase.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceBase.java
@@ -45,6 +45,7 @@ public class ResourceBase implements Constants {
   }
   
   protected Response processException(Throwable exp) {
+    servlet.getMetrics().incrementProcessException(1);
     Throwable curr = exp;
     if(accessDeniedClazz != null) {
       //some access denied exceptions are buried
{code}

Also, note that the REST gateway embeds the HBase client so the client metrics 
(HBASE-12911) could be made available.

> Add latency metrics for REST
> ----------------------------
>
>                 Key: HBASE-16686
>                 URL: https://issues.apache.org/jira/browse/HBASE-16686
>             Project: HBase
>          Issue Type: New Feature
>          Components: monitoring, REST
>            Reporter: Guang Yang
>            Priority: Minor
>         Attachments: HBASE-16686_v0.patch
>
>
> It would be helpful to have the latency metrics for rest for various 
> operations.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to