Package io.grpc

Interface MetricSink


  • @Internal
    public interface MetricSink
    An internal interface representing a receiver or aggregator of gRPC metrics data.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  MetricSink.Registration  
    • Method Summary

      All Methods Instance Methods Abstract 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 associated with specified 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 associated with specified metric instrument.
      java.util.Map<java.lang.String,​java.lang.Boolean> getEnabledMetrics()
      Returns a set of names for the metrics that are currently enabled or disabled.
      int getMeasuresSize()
      Returns size of metric measures used to record metric values.
      java.util.Set<java.lang.String> getOptionalLabels()
      Returns a set of optional label names for metrics that the sink actually wants.
      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 associated with specified metric instrument.
      default void recordLongGauge​(LongGaugeMetricInstrument metricInstrument, long value, java.util.List<java.lang.String> requiredLabelValues, java.util.List<java.lang.String> optionalLabelValues)
      Record a long gauge value.
      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 associated with specified metric instrument.
      default MetricSink.Registration registerBatchCallback​(java.lang.Runnable callback, CallbackMetricInstrument... metricInstruments)
      Registers a callback to produce metric values for only the listed instruments.
      void updateMeasures​(java.util.List<MetricInstrument> instruments)  
    • Method Detail

      • getEnabledMetrics

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

        java.util.Set<java.lang.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,
                                      java.util.List<java.lang.String> requiredLabelValues,
                                      java.util.List<java.lang.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,
                                    java.util.List<java.lang.String> requiredLabelValues,
                                    java.util.List<java.lang.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,
                                           java.util.List<java.lang.String> requiredLabelValues,
                                           java.util.List<java.lang.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,
                                         java.util.List<java.lang.String> requiredLabelValues,
                                         java.util.List<java.lang.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,
                                     java.util.List<java.lang.String> requiredLabelValues,
                                     java.util.List<java.lang.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​(java.lang.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​(java.util.List<MetricInstrument> instruments)