@Override
  public List<MetricFamilySamples> collect() {
    Map<MetricKey, Metric> registeredMetrics = metrics.getMetrics();

    Map<MetricDefine, List<MetricKey>> metricDefineMap =
        registeredMetrics.keySet().stream()
            .collect(
                Collectors.groupingBy(
                    MetricKey::getDefine,
                    Collectors.mapping(Function.identity(), Collectors.toList())));
    return metricDefineMap.entrySet().stream()
        .filter(entry -> isValidMetric(entry.getKey()))
        .map(entry -> createFamilySample(entry.getKey(), entry.getValue(), registeredMetrics))
        .collect(Collectors.toList());
  }
Metric type converter for prometheus api
amoro-metrics/amoro-metrics-prometheus/src/main/java/org/apache/amoro/metrics/promethues/MetricsCollector.java