public static MetricsConfiguration getSubsetConfiguration(MetricsConfiguration metricsConfiguration, String prefix) {

    if (null == metricsConfiguration) {
      return null;
    }

    Properties properties = metricsConfiguration.getProperties();
    if (null == properties || StringUtils.isEmpty(prefix)) {
      return new MetricsConfiguration(properties);
    }

    Properties subsetProperties = new Properties();

    for (Map.Entry<Object, Object> entry : properties.entrySet()) {
      String key = entry.getKey().toString();
      String val = entry.getValue().toString();
      if (key.startsWith(prefix)) {
        key = key.substring(prefix.length());
        subsetProperties.put(key, val);
      }
    }

    return new MetricsConfiguration(subsetProperties);
  }
Get

@param metricsConfiguration
@param prefix
@return subset configuration which contains the Key-Value pairs whose keys start with the passed in prefix.
ambari-server/src/main/java/org/apache/ambari/server/metrics/system/impl/MetricsConfiguration.java