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

stack commented on HBASE-17716:
-------------------------------

[[email protected]] Hey. I tried to make a start on our agreement above 
and ran into some interesting issues which have me back asking what it is you 
need.

So, first off, InterfaceAudience.Public does not take modification  -- i.e. I 
cannot say what sort of public it is as in METRIC -- which I suppose makes 
sense since its either public or not.

Then, looking at the first set of metrics you want to expose, I see that they 
are actual metrics that are in a class already marked as Public.

So, what you need? Access to the metric names? You need them grouped in a class 
in this patch so you can iterate them or is that not necessary?

Here is the change I made so far... adding the METRIC annotation and then 
starting to break out the metric name as a static final. We could have a 
convention giving them all the _METRIC_NAME suffix. Would that do you?


{code}
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/metrics/ScanMetrics.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/metrics/ScanMetrics.java
index ec2c937..90ac6af 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/metrics/ScanMetrics.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/metrics/ScanMetrics.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.client.metrics;

 import java.util.concurrent.atomic.AtomicLong;

+import org.apache.hadoop.hbase.HBaseInterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;

@@ -44,10 +45,12 @@ public class ScanMetrics extends ServerSideScanMetrics {
   // ScannerCallable. They are atomic longs so that atomic getAndSet can be 
used to reset the
   // values after progress is passed to hadoop's counters.

+  public static final String RPC_CALLS_METRIC_NAME = "RPC_CALLS";
+
   /**
    * number of RPC calls
    */
-  public final AtomicLong countOfRPCcalls = createCounter("RPC_CALLS");
+  public final AtomicLong countOfRPCcalls = 
createCounter(RPC_CALLS_METRIC_NAME);

   /**
    * number of remote RPC calls
diff --git 
a/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseInterfaceAudience.java
 
b/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseInterfaceAudience.java
index cb42e48..1ca3a9d 100644
--- 
a/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseInterfaceAudience.java
+++ 
b/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseInterfaceAudience.java
@@ -21,12 +21,11 @@ import 
org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;

 /**
- * This class defines constants for different classes of hbase limited private 
apis
+ * This class defines constants for different classes of hbase limited private 
APIs.
  */
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public final class HBaseInterfaceAudience {
-
   /**
    * Can't create this class.
    */
@@ -47,4 +46,15 @@ public final class HBaseInterfaceAudience {
    * for class name, and arguments.
    */
   public static final String TOOLS = "Tools";
+
+  /**
+   * Denote a metric name. Metric names are consumed by operators and external 
tools.
+   * They are 'public'. Take care changing metrics whether their Type or 
Naming. Consider
+   * adding a new metric altogether or deprecating via release notes at major 
version
+   * transitions with sufficient warning.
+   *
+   * <p>TODO: a scheme for guarantees and deprecation cycle as we have for API 
but in regard
+   * to metrics.
+   */
+  public static final String METRIC = "Metric";
 }
{code}

> Formalize Scan Metric names
> ---------------------------
>
>                 Key: HBASE-17716
>                 URL: https://issues.apache.org/jira/browse/HBASE-17716
>             Project: HBase
>          Issue Type: Bug
>          Components: metrics
>            Reporter: Karan Mehta
>            Assignee: Karan Mehta
>            Priority: Minor
>         Attachments: HBASE-17716.patch
>
>
> HBase provides various metrics through the API's exposed by ScanMetrics 
> class. 
> The JIRA PHOENIX-3248 requires them to be surfaced through the Phoenix 
> Metrics API. Currently these metrics are referred via hard-coded strings, 
> which are not formal and can break the Phoenix API. Hence we need to refactor 
> the code to assign enums for these metrics.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to