Package io.grpc
Class PartialMetricInstrument
- java.lang.Object
-
- io.grpc.PartialMetricInstrument
-
- All Implemented Interfaces:
MetricInstrument
- Direct Known Subclasses:
DoubleCounterMetricInstrument,DoubleHistogramMetricInstrument,LongCounterMetricInstrument,LongGaugeMetricInstrument,LongHistogramMetricInstrument
@Internal abstract class PartialMetricInstrument extends java.lang.Object implements MetricInstrument
A partial implementation of theMetricInstrumentinterface. This class provides common fields and functionality for metric instruments.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringdescriptionprotected booleanenableByDefaultprotected intindexprotected java.lang.Stringnameprotected java.util.List<java.lang.String>optionalLabelKeysprotected java.util.List<java.lang.String>requiredLabelKeysprotected java.lang.Stringunit
-
Constructor Summary
Constructors Modifier Constructor Description protectedPartialMetricInstrument(int index, java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<java.lang.String> requiredLabelKeys, java.util.List<java.lang.String> optionalLabelKeys, boolean enableByDefault)Constructs a new PartialMetricInstrument with the specified attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription()Returns a description of the metric.intgetIndex()Returns the unique index of this metric instrument.java.lang.StringgetName()Returns the name of the metric.java.util.List<java.lang.String>getOptionalLabelKeys()Returns a list of optional label keys for this metric instrument.java.util.List<java.lang.String>getRequiredLabelKeys()Returns a list of required label keys for this metric instrument.java.lang.StringgetUnit()Returns the unit of measurement for the metric.booleanisEnableByDefault()Indicates whether this metric instrument is enabled by default.java.lang.StringtoString()
-
-
-
Field Detail
-
index
protected final int index
-
name
protected final java.lang.String name
-
description
protected final java.lang.String description
-
unit
protected final java.lang.String unit
-
requiredLabelKeys
protected final java.util.List<java.lang.String> requiredLabelKeys
-
optionalLabelKeys
protected final java.util.List<java.lang.String> optionalLabelKeys
-
enableByDefault
protected final boolean enableByDefault
-
-
Constructor Detail
-
PartialMetricInstrument
protected PartialMetricInstrument(int index, java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<java.lang.String> requiredLabelKeys, java.util.List<java.lang.String> optionalLabelKeys, boolean enableByDefault)Constructs a new PartialMetricInstrument with the specified attributes.- Parameters:
index- the unique index of this metric instrumentname- the name of the metricdescription- a description of the metricunit- the unit of measurement for the metricrequiredLabelKeys- a list of required label keys for the metricoptionalLabelKeys- a list of optional label keys for the metricenableByDefault- whether the metric should be enabled by default
-
-
Method Detail
-
getIndex
public int getIndex()
Description copied from interface:MetricInstrumentReturns the unique index of this metric instrument.- Specified by:
getIndexin interfaceMetricInstrument- Returns:
- the index of the metric instrument.
-
getName
public java.lang.String getName()
Description copied from interface:MetricInstrumentReturns the name of the metric.- Specified by:
getNamein interfaceMetricInstrument- Returns:
- the name of the metric.
-
getDescription
public java.lang.String getDescription()
Description copied from interface:MetricInstrumentReturns a description of the metric.- Specified by:
getDescriptionin interfaceMetricInstrument- Returns:
- a description of the metric.
-
getUnit
public java.lang.String getUnit()
Description copied from interface:MetricInstrumentReturns the unit of measurement for the metric.- Specified by:
getUnitin interfaceMetricInstrument- Returns:
- the unit of measurement.
-
getRequiredLabelKeys
public java.util.List<java.lang.String> getRequiredLabelKeys()
Description copied from interface:MetricInstrumentReturns a list of required label keys for this metric instrument.- Specified by:
getRequiredLabelKeysin interfaceMetricInstrument- Returns:
- a list of required label keys.
-
getOptionalLabelKeys
public java.util.List<java.lang.String> getOptionalLabelKeys()
Description copied from interface:MetricInstrumentReturns a list of optional label keys for this metric instrument.- Specified by:
getOptionalLabelKeysin interfaceMetricInstrument- Returns:
- a list of optional label keys.
-
isEnableByDefault
public boolean isEnableByDefault()
Description copied from interface:MetricInstrumentIndicates whether this metric instrument is enabled by default.- Specified by:
isEnableByDefaultin interfaceMetricInstrument- Returns:
trueif this metric instrument is enabled by default,falseotherwise.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-