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 voidaddDoubleCounter(DoubleCounterMetricInstrument metricInstrument, double value, List<String> requiredLabelValues, List<String> optionalLabelValues) Adds a value for a double-precision counter associated with specified metric instrument.default voidaddLongCounter(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.intReturns size of metric measures used to record metric values.Returns a set of optional label names for metrics that the sink actually wants.default voidrecordDoubleHistogram(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 voidrecordLongGauge(LongGaugeMetricInstrument metricInstrument, long value, List<String> requiredLabelValues, List<String> optionalLabelValues) Record a long gauge value.default voidrecordLongHistogram(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.RegistrationregisterBatchCallback(Runnable callback, CallbackMetricInstrument... metricInstruments) Registers a callback to produce metric values for only the listed instruments.voidupdateMeasures(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
-