Package io.grpc
Interface MetricSink
An internal interface representing a receiver or aggregator of gRPC metrics data.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault void
addDoubleCounter
(DoubleCounterMetricInstrument metricInstrument, double value, List<String> requiredLabelValues, List<String> optionalLabelValues) Adds a value for a double-precision counter associated with specified metric instrument.default void
addLongCounter
(LongCounterMetricInstrument metricInstrument, long value, List<String> requiredLabelValues, List<String> optionalLabelValues) Adds a value for a long valued counter metric associated with specified metric instrument.Returns a set of names for the metrics that are currently enabled or disabled.int
Returns size of metric measures used to record metric values.Returns a set of optional label names for metrics that the sink actually wants.default void
recordDoubleHistogram
(DoubleHistogramMetricInstrument metricInstrument, double value, List<String> requiredLabelValues, List<String> optionalLabelValues) Records a value for a double-precision histogram metric associated with specified metric instrument.default void
recordLongGauge
(LongGaugeMetricInstrument metricInstrument, long value, List<String> requiredLabelValues, List<String> optionalLabelValues) Record a long gauge value.default void
recordLongHistogram
(LongHistogramMetricInstrument metricInstrument, long value, List<String> requiredLabelValues, List<String> optionalLabelValues) Records a value for a long valued histogram metric associated with specified metric instrument.default MetricSink.Registration
registerBatchCallback
(Runnable callback, CallbackMetricInstrument... metricInstruments) Registers a callback to produce metric values for only the listed instruments.void
updateMeasures
(List<MetricInstrument> instruments)
-
Method Details
-
getEnabledMetrics
Returns a set of names for the metrics that are currently enabled or disabled.- Returns:
- A set of enabled metric names.
-
getOptionalLabels
Returns a set of optional label names for metrics that the sink actually wants.- Returns:
- A set of optional label names.
-
getMeasuresSize
int getMeasuresSize()Returns size 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.- Returns:
- Size of metric measures.
-
addDoubleCounter
default void addDoubleCounter(DoubleCounterMetricInstrument metricInstrument, double value, List<String> requiredLabelValues, List<String> optionalLabelValues) Adds a value for a double-precision counter associated with specified metric instrument.- Parameters:
metricInstrument
- The counter metric instrument identifies metric measure to add.value
- The value to record.requiredLabelValues
- A list of required label values for the metric.optionalLabelValues
- A list of additional, optional label values for the metric.
-
addLongCounter
default void addLongCounter(LongCounterMetricInstrument metricInstrument, long value, List<String> requiredLabelValues, List<String> optionalLabelValues) Adds a value for a long valued counter metric associated with specified metric instrument.- Parameters:
metricInstrument
- The counter metric instrument identifies metric measure to add.value
- The value to record.requiredLabelValues
- A list of required label values for the metric.optionalLabelValues
- A list of additional, optional label values for the metric.
-
recordDoubleHistogram
default void recordDoubleHistogram(DoubleHistogramMetricInstrument metricInstrument, double value, List<String> requiredLabelValues, List<String> optionalLabelValues) Records a value for a double-precision histogram metric associated with specified metric instrument.- Parameters:
metricInstrument
- The histogram metric instrument identifies metric measure to record.value
- The value to record.requiredLabelValues
- A list of required label values for the metric.optionalLabelValues
- A list of additional, optional label values for the metric.
-
recordLongHistogram
default void recordLongHistogram(LongHistogramMetricInstrument metricInstrument, long value, List<String> requiredLabelValues, List<String> optionalLabelValues) Records a value for a long valued histogram metric associated with specified metric instrument.- Parameters:
metricInstrument
- The histogram metric instrument identifies metric measure to record.value
- The value to record.requiredLabelValues
- A list of required label values for the metric.optionalLabelValues
- A list of additional, optional label values for the metric.
-
recordLongGauge
default void recordLongGauge(LongGaugeMetricInstrument metricInstrument, long value, List<String> requiredLabelValues, List<String> optionalLabelValues) Record a long gauge value.- Parameters:
value
- The value to record.requiredLabelValues
- A list of required label values for the metric.optionalLabelValues
- A list of additional, optional label values for the metric.
-
registerBatchCallback
default MetricSink.Registration registerBatchCallback(Runnable callback, CallbackMetricInstrument... metricInstruments) Registers a callback to produce metric values for only the listed instruments. The returned registration must be closed when no longer needed, which will remove the callback.- Parameters:
callback
- The callback to call to record.metricInstruments
- The metric instruments the callback will record against.
-
updateMeasures
-