You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by av...@apache.org on 2016/04/12 00:09:15 UTC
ambari git commit: AMBARI-15698 : Metrics is not showing data
(avijayan)
Repository: ambari
Updated Branches:
refs/heads/branch-2.2 ea9775598 -> f04d81dad
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/f04d81da
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f04d81da
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f04d81da
Branch: refs/heads/branch-2.2
Commit: f04d81dad41bbec093c09d9feb1f3a4e94a15f4c
Parents: ea97755
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Mon Apr 11 15:09:06 2016 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Mon Apr 11 15:09:06 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/f04d81da/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 cd0a0fd..51cacf3 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
@@ -638,7 +638,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);
@@ -653,13 +653,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/f04d81da/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 ecd9d70..4bea268 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
@@ -84,6 +84,7 @@ import java.util.Scanner;
import java.util.Set;
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;
@@ -924,7 +925,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/f04d81da/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);