Package io.grpc

Interface MetricSink


@Internal public interface MetricSink
An internal interface representing a receiver or aggregator of gRPC metrics data.
  • Method Details

    • getEnabledMetrics

      Map<String,Boolean> getEnabledMetrics()
      Returns a set of names for the metrics that are currently enabled or disabled.
      Returns:
      A set of enabled metric names.
    • getOptionalLabels

      Set<String> 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

      void updateMeasures(List<MetricInstrument> instruments)