accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubbsii <...@git.apache.org>
Subject [GitHub] accumulo pull request #291: ACCUMULO-4693: Add instance-specific ProcessName...
Date Mon, 14 Aug 2017 23:23:33 GMT
Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/291#discussion_r133086237
  
    --- Diff: 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")) {
    +      for (Map.Entry<Object,Object> p : System.getProperties().entrySet()) {
    +        if (((String) p.getKey()).contains("instance")) {
    --- End diff --
    
    I'm not sure it matters where in the call chain it's grabbed. I don't really know much
about the Hadoop Metrics library. I was thinking maybe you could create a "SystemProperties"
tag or something like that, and then on the client side of the metrics, pull out the specific
property you need. That way, the only thing tied to the specific property was the launch script
and the metrics consumer... and not any part of Accumulo's code.
    
    However, if that is not feasible for whatever reason, using the specific flag, if present,
seems perfectly appropriate to me to me. It's basically what we did for the monitor log appender.
    
    If you wanted to push the service name implementation into the TabletServer, rather than
the metrics code, that would work, too. Could create a method, `tabletServer.getServiceName()`
or similar, to place the property-retrieval implementation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message