private static List<MetricsPacket> processAndBuild(MetricsPacket.Builder [] builders,
                                                       MetricsProcessor... processors) {
        List<MetricsPacket> metricsPackets = new ArrayList<>(builders.length);
        for (int i = 0; i < builders.length; i++) {
            applyProcessors(builders[i], processors);
            metricsPackets.add(builders[i].build());
            builders[i] = null; // Set null to be able to GC the builder when packet has been created
        }
        return metricsPackets;
    }
Http handler for the metrics/v2 rest api.

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