Package io.grpc

Interface MetricRecorder


@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.
  • Method Details

    • addDoubleCounter

      default void addDoubleCounter(DoubleCounterMetricInstrument metricInstrument, double value, List<String> requiredLabelValues, List<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, List<String> requiredLabelValues, List<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, List<String> requiredLabelValues, List<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, List<String> requiredLabelValues, List<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.