Package io.grpc

Class MetricInstrumentRegistry

java.lang.Object
io.grpc.MetricInstrumentRegistry

@Internal public final class MetricInstrumentRegistry extends Object
A registry for globally registered metric instruments.
  • Method Details

    • getDefaultRegistry

      public static MetricInstrumentRegistry getDefaultRegistry()
      Returns the default metric instrument registry.
    • getMetricInstruments

      public List<MetricInstrument> getMetricInstruments()
      Returns a list of registered metric instruments.
    • registerDoubleCounter

      public DoubleCounterMetricInstrument registerDoubleCounter(String name, String description, String unit, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault)
      Registers a new Double Counter metric instrument.
      Parameters:
      name - the name of the metric
      description - a description of the metric
      unit - the unit of measurement for the metric
      requiredLabelKeys - a list of required label keys
      optionalLabelKeys - a list of optional label keys
      enableByDefault - whether the metric should be enabled by default
      Returns:
      the newly created DoubleCounterMetricInstrument
      Throws:
      IllegalStateException - if a metric with the same name already exists
    • registerLongCounter

      public LongCounterMetricInstrument registerLongCounter(String name, String description, String unit, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault)
      Registers a new Long Counter metric instrument.
      Parameters:
      name - the name of the metric
      description - a description of the metric
      unit - the unit of measurement for the metric
      requiredLabelKeys - a list of required label keys
      optionalLabelKeys - a list of optional label keys
      enableByDefault - whether the metric should be enabled by default
      Returns:
      the newly created LongCounterMetricInstrument
      Throws:
      IllegalStateException - if a metric with the same name already exists
    • registerDoubleHistogram

      public DoubleHistogramMetricInstrument registerDoubleHistogram(String name, String description, String unit, List<Double> bucketBoundaries, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault)
      Registers a new Double Histogram metric instrument.
      Parameters:
      name - the name of the metric
      description - a description of the metric
      unit - the unit of measurement for the metric
      bucketBoundaries - recommended set of explicit bucket boundaries for the histogram
      requiredLabelKeys - a list of required label keys
      optionalLabelKeys - a list of optional label keys
      enableByDefault - whether the metric should be enabled by default
      Returns:
      the newly created DoubleHistogramMetricInstrument
      Throws:
      IllegalStateException - if a metric with the same name already exists
    • registerLongHistogram

      public LongHistogramMetricInstrument registerLongHistogram(String name, String description, String unit, List<Long> bucketBoundaries, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault)
      Registers a new Long Histogram metric instrument.
      Parameters:
      name - the name of the metric
      description - a description of the metric
      unit - the unit of measurement for the metric
      bucketBoundaries - recommended set of explicit bucket boundaries for the histogram
      requiredLabelKeys - a list of required label keys
      optionalLabelKeys - a list of optional label keys
      enableByDefault - whether the metric should be enabled by default
      Returns:
      the newly created LongHistogramMetricInstrument
      Throws:
      IllegalStateException - if a metric with the same name already exists
    • registerLongGauge

      public LongGaugeMetricInstrument registerLongGauge(String name, String description, String unit, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault)
      Registers a new Long Gauge metric instrument.
      Parameters:
      name - the name of the metric
      description - a description of the metric
      unit - the unit of measurement for the metric
      requiredLabelKeys - a list of required label keys
      optionalLabelKeys - a list of optional label keys
      enableByDefault - whether the metric should be enabled by default
      Returns:
      the newly created LongGaugeMetricInstrument
      Throws:
      IllegalStateException - if a metric with the same name already exists