ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avija...@apache.org
Subject ambari git commit: AMBARI-18344 : Metrics data is not available - AMS in distributed mode. (avijayan)
Date Tue, 04 Oct 2016 17:36:17 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 b34104001 -> f93460c56


AMBARI-18344 : Metrics data is not available - AMS in distributed mode. (avijayan)


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

Branch: refs/heads/branch-2.5
Commit: f93460c56dfaaa8e5bd104bf50566ecb9f9f2c50
Parents: b341040
Author: Aravindan Vijayan <avijayan@hortonworks.com>
Authored: Tue Oct 4 10:36:09 2016 -0700
Committer: Aravindan Vijayan <avijayan@hortonworks.com>
Committed: Tue Oct 4 10:36:09 2016 -0700

----------------------------------------------------------------------
 .../metrics/timeline/PhoenixHBaseAccessor.java  |  6 +++++-
 .../timeline/discovery/TestMetadataManager.java | 22 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f93460c5/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
index dfd730d..f40dd6c 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
@@ -68,6 +68,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -713,10 +714,13 @@ public class PhoenixHBaseAccessor {
       LOG.debug("Empty metrics insert request.");
       return;
     }
-    for (TimelineMetric tm: timelineMetrics) {
+    for (Iterator<TimelineMetric> iterator = timelineMetrics.iterator(); iterator.hasNext();)
{
+
+      TimelineMetric tm = iterator.next();
 
       if (CollectionUtils.isNotEmpty(AggregatorUtils.whitelistedMetrics) &&
         !AggregatorUtils.whitelistedMetrics.contains(tm.getMetricName())) {
+        iterator.remove();
         continue;
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f93460c5/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
index 7363a61..e99c001 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/discovery/TestMetadataManager.java
@@ -23,11 +23,14 @@ import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
 import org.apache.hadoop.metrics2.sink.timeline.TimelineMetricMetadata;
 import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
 import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.AbstractMiniHBaseClusterTest;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.aggregators.AggregatorUtils;
 import org.junit.Before;
 import org.junit.Test;
 
 import java.io.IOException;
 import java.sql.SQLException;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
@@ -69,6 +72,25 @@ public class TestMetadataManager extends AbstractMiniHBaseClusterTest {
     }});
     timelineMetrics.getMetrics().add(metric2);
 
+
+    //Test whitelisting
+    TimelineMetric metric3 = new TimelineMetric();
+    metric3.setMetricName("dummy_metric3");
+    metric3.setHostName("dummy_host3");
+    metric3.setTimestamp(now);
+    metric3.setStartTime(now - 1000);
+    metric3.setAppId("dummy_app3");
+    metric3.setType("Integer");
+    metric3.setMetricValues(new TreeMap<Long, Double>() {{
+      put(now - 100, 1.0);
+      put(now - 200, 2.0);
+      put(now - 300, 3.0);
+    }});
+    timelineMetrics.getMetrics().add(metric3);
+
+    AggregatorUtils.whitelistedMetrics.add("dummy_metric1");
+    AggregatorUtils.whitelistedMetrics.add("dummy_metric2");
+
     hdb.insertMetricRecordsWithMetadata(metadataManager, timelineMetrics, true);
   }
 


Mime
View raw message