blob: 770b8524eead8c0f0575796c453188cf41e7574b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.metricsproxy.metric.model.processing;
import ai.vespa.metricsproxy.metric.model.MetricsPacket;
import java.util.Arrays;
/**
* Interface for classes that make amendments to a metrics packet builder.
* Includes a utility method to apply a list of processors to a metrics packet.
*
* @author gjoranv
*/
public interface MetricsProcessor {
/**
* Processes the metrics packet builder in-place.
*/
void process(MetricsPacket.Builder builder);
/**
* Helper method to apply a list of processors to a metrics packet builder.
* Returns the metrics packet builder (which has been processed in-place) for
* convenient use in stream processing.
*/
static MetricsPacket.Builder applyProcessors(MetricsPacket.Builder builder, MetricsProcessor... processors) {
Arrays.stream(processors).forEach(processor -> processor.process(builder));
return builder;
}
}
|