Repository: ambari Updated Branches: refs/heads/trunk 20e66fbb2 -> ef0bc272c
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/ef0bc272 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ef0bc272 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ef0bc272 Branch: refs/heads/trunk Commit: ef0bc272c5385aa6c935de78553106307da8a31e Parents: 20e66fb Author: Aravindan Vijayan <avija...@hortonworks.com> Authored: Tue Apr 12 17:30:27 2016 -0700 Committer: Aravindan Vijayan <avija...@hortonworks.com> Committed: Tue Apr 12 17:30:27 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/ef0bc272/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 72da63e..fd55e86 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 @@ -673,8 +673,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/ef0bc272/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;