public static ConsumerId getConsumerOrDefault(String requestedConsumer, MetricsConsumers consumers) {
        if (requestedConsumer == null) return defaultMetricsConsumerId;

        Optional<ConsumerId> consumerId = consumers.getAllConsumers().stream()
                .filter(consumer -> consumer.id.equalsIgnoreCase(requestedConsumer))
                .findFirst();

        if (consumerId.isPresent()) return consumerId.get();

        log.info("No consumer with id '" + requestedConsumer + "' - using the default consumer instead.");
        return defaultMetricsConsumerId;
    }
Generates metrics values in json format for the metrics/v1 rest api.

@author gjoranv
metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/ValuesFetcher.java