Repository: ambari Updated Branches: refs/heads/branch-2.2 be91695bf -> 87ec53da5
AMBARI-15698 : Metrics is not showing data - Patch 2 (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/87ec53da Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/87ec53da Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/87ec53da Branch: refs/heads/branch-2.2 Commit: 87ec53da5db37f1d6ea1246a9b8d0997c7d78c55 Parents: be91695 Author: Aravindan Vijayan <[email protected]> Authored: Tue Apr 12 17:04:59 2016 -0700 Committer: Aravindan Vijayan <[email protected]> Committed: Tue Apr 12 17:04:59 2016 -0700 ---------------------------------------------------------------------- .../metrics/timeline/PhoenixHBaseAccessor.java | 3 +-- .../metrics/timeline/aggregators/TimelineMetricReadHelper.java | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/87ec53da/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 51cacf3..813387f 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 @@ -671,8 +671,7 @@ public class PhoenixHBaseAccessor { } else { SingleValuedTimelineMetric metric = - TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs, - Function.DEFAULT_VALUE_FUNCTION); + TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs, f); if (condition.isGrouped()) { metrics.addOrMergeTimelineMetric(metric); } else { http://git-wip-us.apache.org/repos/asf/ambari/blob/87ec53da/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricReadHelper.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricReadHelper.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricReadHelper.java index bec103a..7a74e24 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricReadHelper.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricReadHelper.java @@ -50,8 +50,9 @@ public class TimelineMetricReadHelper { public SingleValuedTimelineMetric getAggregatedTimelineMetricFromResultSet(ResultSet rs, Function f) throws SQLException, IOException { + Function function = (f != null) ? f : Function.DEFAULT_VALUE_FUNCTION; SingleValuedTimelineMetric metric = new SingleValuedTimelineMetric( - rs.getString("METRIC_NAME") + f.getSuffix(), + rs.getString("METRIC_NAME") + function.getSuffix(), rs.getString("APP_ID"), rs.getString("INSTANCE_ID"), rs.getString("HOSTNAME"), @@ -61,7 +62,7 @@ public class TimelineMetricReadHelper { ); double value; - switch(f.getReadFunction()){ + switch(function.getReadFunction()){ case AVG: value = rs.getDouble("METRIC_SUM") / rs.getInt("METRIC_COUNT"); break;
