ctubbsii commented on a change in pull request #290: ACCUMULO-4392: Expose 
metrics2 JVM metrics
URL: https://github.com/apache/accumulo/pull/290#discussion_r178375425
 
 

 ##########
 File path: 
server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsSystemHelper.java
 ##########
 @@ -16,20 +16,65 @@
  */
 package org.apache.accumulo.server.metrics;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.hadoop.metrics2.MetricsSystem;
 import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.source.JvmMetrics;
+import org.apache.hadoop.metrics2.source.JvmMetricsInfo;
 
 /**
  *
  */
 public class MetricsSystemHelper {
 
+  private static Map<String,String> serviceNameMap = new HashMap<>();
+  private static String processName = "Unknown";
+
+  static {
+    serviceNameMap.put("master", "Master");
+    serviceNameMap.put("tserver", "TabletServer");
+    serviceNameMap.put("monitor", "Monitor");
+    serviceNameMap.put("gc", "GarbageCollector");
+    serviceNameMap.put("tracer", "Tracer");
+    serviceNameMap.put("shell", "Shell");
+  }
+
+  public static void configure(String application) {
+    String serviceName = application;
+    if (MetricsSystemHelper.serviceNameMap.containsKey(application)) {
+      serviceName = MetricsSystemHelper.serviceNameMap.get(application);
+    }
+
+    // a system property containing 'instance' can be used if more than one 
TabletServer is started on a host
+    String serviceInstance = "";
+    if (serviceName.equals("TabletServer")) {
 
 Review comment:
   This isn't necessary, since the service name can be configured with any 
numeric suffix the user desires, without doing any serviceName translation 
using the serviceNameMap.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to