private static Map<String, Map<String, List<MetricDefinition>>> removeAggregateFunctions(
          Map<String, Map<String, List<MetricDefinition>>> serviceMetrics  ) {
    Map<String, Map<String, List<MetricDefinition>>> filteredServiceMetrics = null;

    if (serviceMetrics != null) {
      filteredServiceMetrics = new HashMap<>();
      // For every Component
      for (String component : serviceMetrics.keySet()) {
        Map<String, List<MetricDefinition>> componentMetricsCopy = new HashMap<>();
        Map<String, List<MetricDefinition>> componentMetrics = serviceMetrics.get(component);
        // For every Component / HostComponent category retrieve metrics definitions
        for (String category : componentMetrics.keySet()) {
          componentMetricsCopy.put(category,
            removeAggregateFunctions(componentMetrics.get(category)));
        }
        filteredServiceMetrics.put(component, componentMetricsCopy);
      }
    }
    return filteredServiceMetrics;
  }
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