You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2016/04/05 17:12:50 UTC
ambari git commit: AMBARI-15708 "Wrong metrics path " exceptions for
JMX metrics (dsen)
Repository: ambari
Updated Branches:
refs/heads/trunk 2fa50206f -> b5aa1d34a
AMBARI-15708 "Wrong metrics path " exceptions for JMX metrics (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b5aa1d34
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b5aa1d34
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b5aa1d34
Branch: refs/heads/trunk
Commit: b5aa1d34a1c259dcfc4ebf3b9bce233bd8cdfbc6
Parents: 2fa5020
Author: Dmytro Sen <ds...@apache.org>
Authored: Tue Apr 5 18:12:21 2016 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Tue Apr 5 18:12:21 2016 +0300
----------------------------------------------------------------------
.../server/api/services/AmbariMetaInfo.java | 27 +++++++++-----------
.../state/alert/AggregateDefinitionMapping.java | 2 +-
.../ambari/server/topology/PersistedState.java | 2 +-
.../server/api/services/AmbariMetaInfoTest.java | 17 +++++++++++-
.../StackDefinedPropertyProviderTest.java | 6 +----
5 files changed, 31 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b5aa1d34/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 c243552..9b6722d 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
@@ -920,24 +920,21 @@ public class AmbariMetaInfo {
while (iterator.hasNext()) {
Map.Entry<String, Metric> metricEntry = iterator.next();
// Process Namenode rpc metrics
- Map<String, Metric> replacementMetrics = PropertyHelper.processRpcMetricDefinition(metricDefinition.getType(),
+ Map<String, Metric> processedMetrics = PropertyHelper.processRpcMetricDefinition(metricDefinition.getType(),
componentName, metricEntry.getKey(), metricEntry.getValue());
- if (replacementMetrics != null) {
+ if (processedMetrics != null) {
iterator.remove(); // Remove current metric entry
- newMetricsToAdd.putAll(replacementMetrics);
- // Add aggregate functions for replacement metrics
- if (metricDefEntry.getKey().equals(Component.name())) {
- for (Map.Entry<String, Metric> replacementMetric : replacementMetrics.entrySet()) {
- newMetricsToAdd.putAll(getAggregateFunctionMetrics(replacementMetric.getKey(),
- replacementMetric.getValue()));
- }
- }
+ newMetricsToAdd.putAll(processedMetrics);
} else {
- // NOTE: Only Component aggregates supported for now.
- if (metricDefEntry.getKey().equals(Component.name())) {
- Map<String, Metric> aggregateFunctionMetrics =
- getAggregateFunctionMetrics(metricEntry.getKey(), metricEntry.getValue());
- newMetricsToAdd.putAll(aggregateFunctionMetrics);
+ processedMetrics = Collections.singletonMap(metricEntry.getKey(), metricEntry.getValue());
+ }
+
+ // NOTE: Only Component aggregates for AMS supported for now.
+ if (metricDefinition.getType().equals("ganglia") &&
+ metricDefEntry.getKey().equals(Component.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/b5aa1d34/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java
index 21ad99b..100537c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java
@@ -96,7 +96,7 @@ public class AggregateDefinitionMapping {
*
* @param clusterId
* the ID of the cluster that the definition is bound to.
- * @param name
+ * @param aggregatedDefinitonName
* the unique name of the definition for which aggregates should be
* unassociated (not {@code null}).
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/b5aa1d34/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
index 1ccd527..77419d8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
@@ -30,7 +30,7 @@ public interface PersistedState {
/**
* Persist a topology request.
*
- * @param topologyRequest topologyh request to persist
+ * @param topologyRequest topology request to persist
*
* @return a persisted topology request which is a wrapper around a TopologyRequest which
* adds an id that can be used to refer to the persisted entity
http://git-wip-us.apache.org/repos/asf/ambari/blob/b5aa1d34/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 2730463..10b92d4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -645,7 +645,7 @@ public class AmbariMetaInfoTest {
@Test
public void testGetStacks() {
- Collection<StackInfo> stacks = metaInfo.getStacks();
+ //Collection<StackInfo> stacks = metaInfo.getStacks();
//todo: complete test
}
@@ -895,6 +895,7 @@ public class AmbariMetaInfoTest {
List<MetricDefinition> list = metaInfo.getMetrics(STACK_NAME_HDP, "2.0.5", "HDFS", SERVICE_COMPONENT_NAME, Resource.Type.Component.name());
Assert.assertNotNull(list);
+ checkNoAggregatedFunctionsForJmx(list);
list = metaInfo.getMetrics(STACK_NAME_HDP, "2.0.5", "HDFS", "DATANODE", Resource.Type.Component.name());
Assert.assertNull(list);
@@ -954,6 +955,8 @@ public class AmbariMetaInfoTest {
if (list == null) {
LOG.info("No metrics found for " + currentComponentInfo);
continue;
+ } else {
+ checkNoAggregatedFunctionsForJmx(list);
}
LOG.info("Cross-checking JMX-to-Ganglia metrics for " + currentComponentInfo);
@@ -2015,6 +2018,18 @@ public class AmbariMetaInfoTest {
return metaInfo;
}
+ private static void checkNoAggregatedFunctionsForJmx(List<MetricDefinition> metricDefinitions) {
+ for (MetricDefinition metricDefinition: metricDefinitions) {
+ if ("jmx".equals(metricDefinition.getType())) {
+ for (String metric: metricDefinition.getMetrics().keySet()) {
+ if (metric.endsWith("._sum")) {
+ Assert.fail("Aggregated functions aren't supported for JMX metrics. " + metric);
+ }
+ }
+ }
+ }
+ }
+
private static void waitForAllReposToBeResolved(AmbariMetaInfo metaInfo) throws Exception {
int maxWait = 45000;
int waitTime = 0;
http://git-wip-us.apache.org/repos/asf/ambari/blob/b5aa1d34/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
index cc4bd54..32e84cb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
@@ -989,10 +989,6 @@ public class StackDefinedPropertyProviderTest {
Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
- List<String> metricsRegexes = new ArrayList<String>();
-
- metricsRegexes.add("metrics/yarn/Queue/$1.replaceAll(\"([.])\",\"/\")/");
-
Assert.assertTrue(PropertyHelper.getProperties(resource).size() > 2);
Assert.assertNotNull(resource.getPropertyValue(RM_AVAILABLE_MEMORY_PROPERTY));
}
@@ -1229,4 +1225,4 @@ public class StackDefinedPropertyProviderTest {
return "8020".equals(port) ? "client" : null;
}
}
-}
\ No newline at end of file
+}