You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2014/12/10 20:39:51 UTC

ambari git commit: AMBARI-8420. Add Amabri Metric Provider to get metrics from AMS. Check liveliness. (swagle)

Repository: ambari
Updated Branches:
  refs/heads/trunk 7bf992ddb -> d2bc0ac81


AMBARI-8420. Add Amabri Metric Provider to get metrics from AMS. Check liveliness. (swagle)


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

Branch: refs/heads/trunk
Commit: d2bc0ac8193e13988879bde4078a7406bacd0935
Parents: 7bf992d
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Dec 10 11:34:53 2014 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Dec 10 11:39:43 2014 -0800

----------------------------------------------------------------------
 .../metrics/timeline/AMSPropertyProvider.java       | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d2bc0ac8/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 fef5e9d..50eb08e 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
@@ -159,6 +159,22 @@ public abstract class AMSPropertyProvider extends MetricsPropertyProvider {
         Set<Resource> resourceSet = resourceEntry.getValue();
 
         for (Resource resource : resourceSet) {
+          String clusterName = (String) resource.getPropertyValue(clusterNamePropertyId);
+
+          // Check liveliness of host
+          if (!hostProvider.isCollectorHostLive(clusterName, TIMELINE_METRICS)) {
+            LOG.info("METRIC_COLLECTOR host is not live. Skip populating " +
+              "resources with metrics.");
+            return Collections.emptySet();
+          }
+
+          // Check liveliness of Collector
+          if (!hostProvider.isCollectorComponentLive(clusterName, TIMELINE_METRICS)) {
+            LOG.info("METRIC_COLLECTOR is not live. Skip populating resources" +
+              " with metrics.");
+            return Collections.emptySet();
+          }
+
           String metricsParam = getSetString(metrics.keySet(), -1);
           // Reuse uriBuilder
           uriBuilder.removeQuery();