forked from grpc/grpc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MetricSink.java
103 lines (92 loc) · 3.97 KB
/
MetricSink.java
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* Copyright 2024 The gRPC Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.grpc;
import java.util.List;
import java.util.Set;
/**
* An internal interface representing a receiver or aggregator of gRPC metrics data.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/11110")
public interface MetricSink {
/**
* Returns a set of names for the metrics that are currently enabled for this `MetricSink`.
*
* @return A set of enabled metric names.
*/
Set<String> getEnabledMetrics();
/**
* Returns a list of label names that are considered optional for metrics collected by this
* `MetricSink`.
*
* @return A list of optional label names.
*/
List<String> getOptionalLabels();
/**
* Returns a list of metric measures used to record metric values. These measures are created
* based on registered metrics (via MetricInstrumentRegistry) and are ordered according to their
* registration sequence.
*
* @return A list of metric measures.
*/
List<Object> getMetricsMeasures();
/**
* Records a value for a double-precision counter associated with specified metric instrument.
*
* @param metricInstrument The counter metric instrument identifies metric measure to record.
* @param value The value to record.
* @param requiredLabelValues A list of required label values for the metric.
* @param optionalLabelValues A list of additional, optional label values for the metric.
*/
default void recordDoubleCounter(DoubleCounterMetricInstrument metricInstrument, double value,
List<String> requiredLabelValues, List<String> optionalLabelValues) {
}
/**
* Records a value for a long valued counter metric associated with specified metric instrument.
*
* @param metricInstrument The counter metric instrument identifies metric measure to record.
* @param value The value to record.
* @param requiredLabelValues A list of required label values for the metric.
* @param optionalLabelValues A list of additional, optional label values for the metric.
*/
default void recordLongCounter(LongCounterMetricInstrument metricInstrument, long value,
List<String> requiredLabelValues, List<String> optionalLabelValues) {
}
/**
* Records a value for a double-precision histogram metric associated with specified metric
* instrument.
*
* @param metricInstrument The histogram metric instrument identifies metric measure to record.
* @param value The value to record.
* @param requiredLabelValues A list of required label values for the metric.
* @param optionalLabelValues A list of additional, optional label values for the metric.
*/
default void recordDoubleHistogram(DoubleHistogramMetricInstrument metricInstrument, double value,
List<String> requiredLabelValues, List<String> optionalLabelValues) {
}
/**
* Records a value for a long valued histogram metric associated with specified metric
* instrument.
*
* @param metricInstrument The histogram metric instrument identifies metric measure to record.
* @param value The value to record.
* @param requiredLabelValues A list of required label values for the metric.
* @param optionalLabelValues A list of additional, optional label values for the metric.
*/
default void recordLongHistogram(LongHistogramMetricInstrument metricInstrument, long value,
List<String> requiredLabelValues, List<String> optionalLabelValues) {
}
default void updateMeasures(List<MetricInstrument> instruments) {}
}