Repository: ambari Updated Branches: refs/heads/trunk 579982cdd -> e91f2a656
AMBARI-15698 : Metrics is not showing data (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e91f2a65 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e91f2a65 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e91f2a65 Branch: refs/heads/trunk Commit: e91f2a656dd4bb037bd0a29b0cf207e6993d4836 Parents: 579982c Author: Aravindan Vijayan <[email protected]> Authored: Mon Apr 11 15:18:57 2016 -0700 Committer: Aravindan Vijayan <[email protected]> Committed: Mon Apr 11 15:18:57 2016 -0700 ---------------------------------------------------------------------- .../metrics/timeline/PhoenixHBaseAccessor.java | 9 ++++++--- .../apache/ambari/server/api/services/AmbariMetaInfo.java | 4 +++- .../ambari/server/controller/utilities/PropertyHelper.java | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e91f2a65/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 df2d619..72da63e 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 @@ -640,7 +640,7 @@ public class PhoenixHBaseAccessor { } for (Function f : functions) { if (f.getReadFunction() == Function.ReadFunction.VALUE) { - getTimelineMetricsFromResultSet(metrics, condition, rs); + getTimelineMetricsFromResultSet(metrics, f, condition, rs); } else { SingleValuedTimelineMetric metric = TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs, f); @@ -655,13 +655,16 @@ public class PhoenixHBaseAccessor { } else { // No aggregation requested // Execution never goes here, function always contain at least 1 element - getTimelineMetricsFromResultSet(metrics, condition, rs); + getTimelineMetricsFromResultSet(metrics, null, condition, rs); } } - private void getTimelineMetricsFromResultSet(TimelineMetrics metrics, Condition condition, ResultSet rs) throws SQLException, IOException { + private void getTimelineMetricsFromResultSet(TimelineMetrics metrics, Function f, Condition condition, ResultSet rs) throws SQLException, IOException { if (condition.getPrecision().equals(Precision.SECONDS)) { TimelineMetric metric = TIMELINE_METRIC_READ_HELPER.getTimelineMetricFromResultSet(rs); + if (f != null && f.getSuffix() != null) { //Case : Requesting "._rate" for precision data + metric.setMetricName(metric.getMetricName() + f.getSuffix()); + } if (condition.isGrouped()) { metrics.addOrMergeTimelineMetric(metric); } else { http://git-wip-us.apache.org/repos/asf/ambari/blob/e91f2a65/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java index 9b6722d..df65010 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java @@ -19,6 +19,7 @@ package org.apache.ambari.server.api.services; import static org.apache.ambari.server.controller.spi.Resource.InternalType.Component; +import static org.apache.ambari.server.controller.spi.Resource.InternalType.HostComponent; import static org.apache.ambari.server.controller.utilities.PropertyHelper.AGGREGATE_FUNCTION_IDENTIFIERS; import java.io.File; @@ -931,7 +932,8 @@ public class AmbariMetaInfo { // NOTE: Only Component aggregates for AMS supported for now. if (metricDefinition.getType().equals("ganglia") && - metricDefEntry.getKey().equals(Component.name())) { + (metricDefEntry.getKey().equals(Component.name()) || + metricDefEntry.getKey().equals(HostComponent.name()))) { for (Map.Entry<String, Metric> processedMetric : processedMetrics.entrySet()) { newMetricsToAdd.putAll(getAggregateFunctionMetrics(processedMetric.getKey(), processedMetric.getValue())); http://git-wip-us.apache.org/repos/asf/ambari/blob/e91f2a65/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java index 87a1ab1..bddce28 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java @@ -58,7 +58,7 @@ public class PropertyHelper { * Aggregate functions implicitly supported by the Metrics Service */ public static final List<String> AGGREGATE_FUNCTION_IDENTIFIERS = - Arrays.asList("._sum", "._max", "._min", "._avg"); + Arrays.asList("._sum", "._max", "._min", "._avg", "._rate"); private static final List<Resource.InternalType> REPORT_METRIC_RESOURCES = Arrays.asList(Resource.InternalType.Cluster, Resource.InternalType.Host);
