ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject ambari git commit: AMBARI-8594. Push AMS Hbase metrics with its own appid. (swagle)
Date Tue, 09 Dec 2014 04:14:51 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 23e0228c4 -> cda2ea25f


AMBARI-8594. Push AMS Hbase metrics with its own appid. (swagle)


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

Branch: refs/heads/trunk
Commit: cda2ea25f55d05b8d995af63ba05c055e9d313df
Parents: 23e0228
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Mon Dec 8 20:14:34 2014 -0800
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Mon Dec 8 20:14:40 2014 -0800

----------------------------------------------------------------------
 .../sink/timeline/HadoopTimelineMetricsSink.java        |  9 ++++++++-
 .../metrics/timeline/AMSComponentPropertyProvider.java  |  4 ++--
 .../timeline/AMSHostComponentPropertyProvider.java      |  4 ++--
 .../metrics/timeline/AMSPropertyProvider.java           | 12 +++++++-----
 .../templates/hadoop-metrics2-hbase.properties.j2       |  1 +
 5 files changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cda2ea25/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
b/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
index 8fcf464..0755f51 100644
--- a/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
+++ b/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
@@ -42,6 +42,7 @@ public class HadoopTimelineMetricsSink extends AbstractTimelineMetricsSink
imple
   private String serviceName = "";
   private List<? extends SocketAddress> metricsServers;
   private String collectorUri;
+  private static final String SERVICE_NAME_PREFIX = "serviceName-prefix";
 
   @Override
   public void init(SubsetConfiguration conf) {
@@ -61,7 +62,7 @@ public class HadoopTimelineMetricsSink extends AbstractTimelineMetricsSink
imple
       }
     }
 
-    serviceName = getFirstConfigPrefix(conf);
+    serviceName = getServiceName(conf);
 
     // Load collector configs
     metricsServers = Servers.parse(conf.getString(COLLECTOR_HOST_PROPERTY), 8188);
@@ -106,6 +107,12 @@ public class HadoopTimelineMetricsSink extends AbstractTimelineMetricsSink
imple
     }
   }
 
+  private String getServiceName(SubsetConfiguration conf) {
+    String serviceNamePrefix = conf.getString(SERVICE_NAME_PREFIX, "");
+    return serviceNamePrefix.isEmpty() ? getFirstConfigPrefix(conf) :
+      serviceNamePrefix + "-" + getFirstConfigPrefix(conf);
+  }
+
   private String getFirstConfigPrefix(SubsetConfiguration conf) {
     while (conf.getParent() instanceof SubsetConfiguration) {
       conf = (SubsetConfiguration) conf.getParent();

http://git-wip-us.apache.org/repos/asf/ambari/blob/cda2ea25/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSComponentPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSComponentPropertyProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSComponentPropertyProvider.java
index 944ec5c..815224f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSComponentPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSComponentPropertyProvider.java
@@ -46,8 +46,8 @@ public class AMSComponentPropertyProvider extends AMSPropertyProvider {
   protected String getComponentName(Resource resource) {
     String componentName = (String) resource.getPropertyValue(componentNamePropertyId);
 
-    if (TIMLINE_APPID_MAP.containsKey(componentName)) {
-      componentName = TIMLINE_APPID_MAP.get(componentName);
+    if (TIMELINE_APPID_MAP.containsKey(componentName)) {
+      componentName = TIMELINE_APPID_MAP.get(componentName);
     }
 
     return componentName;

http://git-wip-us.apache.org/repos/asf/ambari/blob/cda2ea25/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSHostComponentPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSHostComponentPropertyProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSHostComponentPropertyProvider.java
index 09836e3..523371a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSHostComponentPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSHostComponentPropertyProvider.java
@@ -47,8 +47,8 @@ public class AMSHostComponentPropertyProvider extends AMSPropertyProvider
{
   protected String getComponentName(Resource resource) {
     String componentName = (String) resource.getPropertyValue(componentNamePropertyId);
 
-    if (TIMLINE_APPID_MAP.containsKey(componentName)) {
-      componentName = TIMLINE_APPID_MAP.get(componentName);
+    if (TIMELINE_APPID_MAP.containsKey(componentName)) {
+      componentName = TIMELINE_APPID_MAP.get(componentName);
     }
 
     return componentName;

http://git-wip-us.apache.org/repos/asf/ambari/blob/cda2ea25/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
index 9e51a61..fef5e9d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
@@ -51,7 +51,7 @@ import static org.apache.ambari.server.controller.metrics.MetricsServiceProvider
 import static org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
 
 public abstract class AMSPropertyProvider extends MetricsPropertyProvider {
-  static final Map<String, String> TIMLINE_APPID_MAP = new HashMap<String, String>();
+  static final Map<String, String> TIMELINE_APPID_MAP = new HashMap<String, String>();
   private static ObjectMapper mapper;
   //private final HttpClient httpClient = new HttpClient();
   private final static ObjectReader timelineObjectReader;
@@ -60,8 +60,10 @@ public abstract class AMSPropertyProvider extends MetricsPropertyProvider
{
   private static final Set<String> PERCENTAGE_METRIC;
 
   static {
-    TIMLINE_APPID_MAP.put("HBASE_MASTER", "HBASE");
-    TIMLINE_APPID_MAP.put("HBASE_REGIONSERVER", "HBASE");
+    TIMELINE_APPID_MAP.put("HBASE_MASTER", "HBASE");
+    TIMELINE_APPID_MAP.put("HBASE_REGIONSERVER", "HBASE");
+    TIMELINE_APPID_MAP.put("METRIC_COLLECTOR", "AMS-HBASE");
+
     mapper = new ObjectMapper();
     AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();
     mapper.setAnnotationIntrospector(introspector);
@@ -171,8 +173,8 @@ public abstract class AMSPropertyProvider extends MetricsPropertyProvider
{
 
           String componentName = getComponentName(resource);
           if (componentName != null && !componentName.isEmpty()) {
-            if (TIMLINE_APPID_MAP.containsKey(componentName)) {
-              componentName = TIMLINE_APPID_MAP.get(componentName);
+            if (TIMELINE_APPID_MAP.containsKey(componentName)) {
+              componentName = TIMELINE_APPID_MAP.get(componentName);
             }
             uriBuilder.setParameter("appId", componentName);
           }

http://git-wip-us.apache.org/repos/asf/ambari/blob/cda2ea25/ambari-server/src/main/resources/stacks/HDP/2.2/services/AMS/package/templates/hadoop-metrics2-hbase.properties.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/AMS/package/templates/hadoop-metrics2-hbase.properties.j2
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/AMS/package/templates/hadoop-metrics2-hbase.properties.j2
index 0d3ce44..3e980f7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/AMS/package/templates/hadoop-metrics2-hbase.properties.j2
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/AMS/package/templates/hadoop-metrics2-hbase.properties.j2
@@ -53,3 +53,4 @@ rpc.collector={{ams_collector_host_single}}:8188
 hbase.sink.timeline.class=org.apache.hadoop.metrics2.sink.timeline.HadoopTimelineMetricsSink
 hbase.sink.timeline.period=10
 hbase.sink.timeline.collector={{ams_collector_host_single}}:8188
+hbase.sink.timeline.serviceName-prefix=ams


Mime
View raw message