public List<SingleMetric> getMetrics() {

    List<SingleMetric> metrics = new ArrayList<>();
    Map<String, Gauge> gaugeSet = registry.getGauges(new NonNumericMetricFilter());
    for (String metricName : gaugeSet.keySet()) {
      Number value = (Number) gaugeSet.get(metricName).getValue();
      metrics.add(new SingleMetric(metricName, value.doubleValue(), System.currentTimeMillis()));
    }

    return metrics;
  }
@{link JvmMetricsSource} collects JVM Metrics using codahale and publish to Metrics Sink.
ambari-server/src/main/java/org/apache/ambari/server/metrics/system/impl/JvmMetricsSource.java