private static List<MetricDefinition> removeAggregateFunctions(List<MetricDefinition> metricsDefinitions) {
    List<MetricDefinition> filteredComponentMetrics = null;

    if (metricsDefinitions != null) {
      filteredComponentMetrics = new ArrayList<>();
      // For every metric definition
      for (MetricDefinition metricDefinition : metricsDefinitions) {
        Map<String, Map<String, Metric>> categorizedMetricsCopy = new HashMap<>();
        Map<String, Map<String, Metric>> categorizedMetrics = metricDefinition.getMetricsByCategory();
        for (String category : categorizedMetrics.keySet()) {
          Map<String, Metric> namedMetricsCopy = new HashMap<>();
          Map<String, Metric> namedMetrics = categorizedMetrics.get(category);
          for (String metricName : namedMetrics.keySet()) {
            // Metrics System metrics only
            if (!(metricDefinition.getType().equals("ganglia") && PropertyHelper.hasAggregateFunctionSuffix(metricName))) {
              namedMetricsCopy.put(metricName, namedMetrics.get(metricName));
            }
          }
          categorizedMetricsCopy.put(category, namedMetricsCopy);
        }
        filteredComponentMetrics.add(
          new MetricDefinition(metricDefinition.getType(), metricDefinition.getProperties(), categorizedMetricsCopy));
      }
    }
    return filteredComponentMetrics;
  }
Get a collection of all service descriptors for the specified stack.

@param stack  stack name

@return collection of all service descriptors for the stack; will not return null

@throws IOException if unable to read or parse a descriptor file
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java