Package io.grpc
Class MetricInstrumentRegistry
java.lang.Object
io.grpc.MetricInstrumentRegistry
A registry for globally registered metric instruments.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
private static MetricInstrumentRegistry
private final Object
private MetricInstrument[]
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MetricInstrumentRegistry
Returns the default metric instrument registry.Returns a list of registered metric instruments.registerDoubleCounter
(String name, String description, String unit, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault) Registers a new Double Counter metric instrument.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.registerLongCounter
(String name, String description, String unit, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault) Registers a new Long Counter metric instrument.registerLongGauge
(String name, String description, String unit, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault) Registers a new Long Gauge metric instrument.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.private void
-
Field Details
-
INITIAL_INSTRUMENT_CAPACITY
static final int INITIAL_INSTRUMENT_CAPACITY- See Also:
-
instance
-
lock
-
registeredMetricNames
-
metricInstruments
-
nextAvailableMetricIndex
private int nextAvailableMetricIndex
-
-
Constructor Details
-
MetricInstrumentRegistry
MetricInstrumentRegistry()
-
-
Method Details
-
getDefaultRegistry
Returns the default metric instrument registry. -
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 metricdescription
- a description of the metricunit
- the unit of measurement for the metricrequiredLabelKeys
- a list of required label keysoptionalLabelKeys
- a list of optional label keysenableByDefault
- 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 metricdescription
- a description of the metricunit
- the unit of measurement for the metricrequiredLabelKeys
- a list of required label keysoptionalLabelKeys
- a list of optional label keysenableByDefault
- 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 metricdescription
- a description of the metricunit
- the unit of measurement for the metricbucketBoundaries
- recommended set of explicit bucket boundaries for the histogramrequiredLabelKeys
- a list of required label keysoptionalLabelKeys
- a list of optional label keysenableByDefault
- 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 metricdescription
- a description of the metricunit
- the unit of measurement for the metricbucketBoundaries
- recommended set of explicit bucket boundaries for the histogramrequiredLabelKeys
- a list of required label keysoptionalLabelKeys
- a list of optional label keysenableByDefault
- 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 metricdescription
- a description of the metricunit
- the unit of measurement for the metricrequiredLabelKeys
- a list of required label keysoptionalLabelKeys
- a list of optional label keysenableByDefault
- whether the metric should be enabled by default- Returns:
- the newly created LongGaugeMetricInstrument
- Throws:
IllegalStateException
- if a metric with the same name already exists
-
resizeMetricInstruments
private void resizeMetricInstruments()
-