public MetricsPacket.Builder[] fetchMetricsAsBuilders(String requestedConsumer) throws JsonRenderingException {
        ConsumerId consumer = getConsumerOrDefault(requestedConsumer, metricsConsumers);

        List<MetricsPacket.Builder> builders = metricsManager.getMetricsAsBuilders(vespaServices.getVespaServices(), Instant.now(), consumer)
                .stream()
                .filter(builder -> builder.hasConsumer(consumer))
                .toList();
        return builders.toArray(new MetricsPacket.Builder[builders.size()]);
    }
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