You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2017/05/03 16:47:25 UTC
[42/53] [abbrv] ambari git commit: AMBARI-20913 : Grafana LLAP
overview dashboard showing incorrect metrics. (avijayan)
AMBARI-20913 : Grafana LLAP overview dashboard showing incorrect metrics. (avijayan)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f4243c3d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f4243c3d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f4243c3d
Branch: refs/heads/branch-feature-AMBARI-12556
Commit: f4243c3d3535311fa7de6790b0fe430ab8deffa7
Parents: 4b588a9
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Tue May 2 15:14:22 2017 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Tue May 2 15:14:22 2017 -0700
----------------------------------------------------------------------
.../aggregators/TimelineMetricClusterAggregator.java | 11 +++++++++--
.../timeline/aggregators/ITClusterAggregator.java | 8 ++++----
2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4243c3d/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregator.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregator.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregator.java
index 02677b9..0934356 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregator.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregator.java
@@ -91,6 +91,7 @@ public class TimelineMetricClusterAggregator extends AbstractTimelineAggregator
MetricHostAggregate hostAggregate = null;
Map<TimelineClusterMetric, MetricHostAggregate> hostAggregateMap =
new HashMap<TimelineClusterMetric, MetricHostAggregate>();
+ int perMetricCount = 0;
while (rs.next()) {
TimelineClusterMetric currentMetric = readHelper.fromResultSet(rs);
@@ -106,14 +107,20 @@ public class TimelineMetricClusterAggregator extends AbstractTimelineAggregator
currentMetric.setTimestamp(endTime);
hostAggregate = new MetricHostAggregate();
hostAggregateMap.put(currentMetric, hostAggregate);
+ perMetricCount++;
}
if (existingMetric.equalsExceptTime(currentMetric)) {
// Recalculate totals with current metric
updateAggregatesFromHost(hostAggregate, currentHostAggregate);
-
+ perMetricCount++;
} else {
- // Switched over to a new metric - save existing
+ // Switched over to a new metric - save new metric
+
+ hostAggregate.setSum(hostAggregate.getSum() / perMetricCount);
+ hostAggregate.setNumberOfSamples(Math.round((float)hostAggregate.getNumberOfSamples() / (float)perMetricCount));
+ perMetricCount = 1;
+
hostAggregate = new MetricHostAggregate();
currentMetric.setTimestamp(endTime);
updateAggregatesFromHost(hostAggregate, currentHostAggregate);
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4243c3d/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/ITClusterAggregator.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/ITClusterAggregator.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/ITClusterAggregator.java
index 590f82a..f083731 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/ITClusterAggregator.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/ITClusterAggregator.java
@@ -659,14 +659,14 @@ public class ITClusterAggregator extends AbstractMiniHBaseClusterTest {
while (rs.next()) {
if ("disk_used".equals(rs.getString("METRIC_NAME"))) {
assertEquals("APP_ID", "test_app", rs.getString("APP_ID"));
- assertEquals("METRIC_SUM", 16.0, rs.getDouble("METRIC_SUM"));
- assertEquals("METRIC_COUNT", 8, rs.getLong("METRIC_COUNT"));
+ assertEquals("METRIC_SUM", 4.0, rs.getDouble("METRIC_SUM"));
+ assertEquals("METRIC_COUNT", 2, rs.getLong("METRIC_COUNT"));
assertEquals("METRIC_MAX", 4.0, rs.getDouble("METRIC_MAX"));
assertEquals("METRIC_MIN", 0.0, rs.getDouble("METRIC_MIN"));
} else if ("disk_free".equals(rs.getString("METRIC_NAME"))) {
assertEquals("APP_ID", "test_app", rs.getString("APP_ID"));
- assertEquals("METRIC_SUM", 4.0, rs.getDouble("METRIC_SUM"));
- assertEquals("METRIC_COUNT", 8, rs.getLong("METRIC_COUNT"));
+ assertEquals("METRIC_SUM", 1.0, rs.getDouble("METRIC_SUM"));
+ assertEquals("METRIC_COUNT", 2, rs.getLong("METRIC_COUNT"));
assertEquals("METRIC_MAX", 1.0, rs.getDouble("METRIC_MAX"));
assertEquals("METRIC_MIN", 1.0, rs.getDouble("METRIC_MIN"));
}