Class MetricRecorderImpl

  • All Implemented Interfaces:
    MetricRecorder

    final class MetricRecorderImpl
    extends java.lang.Object
    implements MetricRecorder
    Provides a central point for gRPC components to record metric values. Metrics can be exported to monitoring systems by configuring one or more MetricSinks.

    This class encapsulates the interaction with metric sinks, including updating them with the latest set of MetricInstruments provided by the MetricInstrumentRegistry.

    • Method Detail

      • addDoubleCounter

        public void addDoubleCounter​(DoubleCounterMetricInstrument metricInstrument,
                                     double value,
                                     java.util.List<java.lang.String> requiredLabelValues,
                                     java.util.List<java.lang.String> optionalLabelValues)
        Records a double counter value.
        Specified by:
        addDoubleCounter in interface MetricRecorder
        Parameters:
        metricInstrument - the DoubleCounterMetricInstrument to record.
        value - the value to record.
        requiredLabelValues - the required label values for the metric.
        optionalLabelValues - the optional label values for the metric.
      • addLongCounter

        public void addLongCounter​(LongCounterMetricInstrument metricInstrument,
                                   long value,
                                   java.util.List<java.lang.String> requiredLabelValues,
                                   java.util.List<java.lang.String> optionalLabelValues)
        Records a long counter value.
        Specified by:
        addLongCounter in interface MetricRecorder
        Parameters:
        metricInstrument - the LongCounterMetricInstrument to record.
        value - the value to record.
        requiredLabelValues - the required label values for the metric.
        optionalLabelValues - the optional label values for the metric.
      • recordDoubleHistogram

        public void recordDoubleHistogram​(DoubleHistogramMetricInstrument metricInstrument,
                                          double value,
                                          java.util.List<java.lang.String> requiredLabelValues,
                                          java.util.List<java.lang.String> optionalLabelValues)
        Records a double histogram value.
        Specified by:
        recordDoubleHistogram in interface MetricRecorder
        Parameters:
        metricInstrument - the DoubleHistogramMetricInstrument to record.
        value - the value to record.
        requiredLabelValues - the required label values for the metric.
        optionalLabelValues - the optional label values for the metric.
      • recordLongHistogram

        public void recordLongHistogram​(LongHistogramMetricInstrument metricInstrument,
                                        long value,
                                        java.util.List<java.lang.String> requiredLabelValues,
                                        java.util.List<java.lang.String> optionalLabelValues)
        Records a long histogram value.
        Specified by:
        recordLongHistogram in interface MetricRecorder
        Parameters:
        metricInstrument - the LongHistogramMetricInstrument to record.
        value - the value to record.
        requiredLabelValues - the required label values for the metric.
        optionalLabelValues - the optional label values for the metric.