Package io.grpc
Interface MetricRecorder
-
- All Known Implementing Classes:
MetricRecorderImpl
@Internal public interface MetricRecorder
An interface used for recording gRPC metrics. Implementations of this interface are responsible for collecting and potentially reporting metrics from various gRPC components.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
MetricRecorder.BatchCallback
Callback to record gauge values.static interface
MetricRecorder.BatchRecorder
Recorder for instrument values produced by a batch callback.static interface
MetricRecorder.Registration
A handle to a registration, that allows unregistration.
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
addDoubleCounter(DoubleCounterMetricInstrument metricInstrument, double value, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
Adds a value for a double-precision counter metric instrument.default void
addLongCounter(LongCounterMetricInstrument metricInstrument, long value, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
Adds a value for a long valued counter metric instrument.default void
recordDoubleHistogram(DoubleHistogramMetricInstrument metricInstrument, double value, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
Records a value for a double-precision histogram metric instrument.default void
recordLongHistogram(LongHistogramMetricInstrument metricInstrument, long value, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
Records a value for a long valued histogram metric instrument.default MetricRecorder.Registration
registerBatchCallback(MetricRecorder.BatchCallback callback, CallbackMetricInstrument... metricInstruments)
Registers a callback to produce metric values for only the listed instruments.
-
-
-
Method Detail
-
addDoubleCounter
default void addDoubleCounter(DoubleCounterMetricInstrument metricInstrument, double value, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
Adds a value for a double-precision counter metric instrument.- Parameters:
metricInstrument
- The counter metric instrument to add the value against.value
- The value to add.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, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
Adds a value for a long valued counter metric instrument.- Parameters:
metricInstrument
- The counter metric instrument to add the value against.value
- The value to add.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, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
Records a value for a double-precision histogram metric instrument.- Parameters:
metricInstrument
- The histogram metric instrument to record the value against.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, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
Records a value for a long valued histogram metric instrument.- Parameters:
metricInstrument
- The histogram metric instrument to record the value against.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 MetricRecorder.Registration registerBatchCallback(MetricRecorder.BatchCallback 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.
-
-