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 theMetricInstrument
interface. This class provides common fields and functionality for metric instruments.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
description
protected boolean
enableByDefault
protected int
index
protected java.lang.String
name
protected java.util.List<java.lang.String>
optionalLabelKeys
protected java.util.List<java.lang.String>
requiredLabelKeys
protected java.lang.String
unit
-
Constructor Summary
Constructors Modifier Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDescription()
Returns a description of the metric.int
getIndex()
Returns the unique index of this metric instrument.java.lang.String
getName()
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.String
getUnit()
Returns the unit of measurement for the metric.boolean
isEnableByDefault()
Indicates whether this metric instrument is enabled by default.java.lang.String
toString()
-
-
-
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:MetricInstrument
Returns the unique index of this metric instrument.- Specified by:
getIndex
in interfaceMetricInstrument
- Returns:
- the index of the metric instrument.
-
getName
public java.lang.String getName()
Description copied from interface:MetricInstrument
Returns the name of the metric.- Specified by:
getName
in interfaceMetricInstrument
- Returns:
- the name of the metric.
-
getDescription
public java.lang.String getDescription()
Description copied from interface:MetricInstrument
Returns a description of the metric.- Specified by:
getDescription
in interfaceMetricInstrument
- Returns:
- a description of the metric.
-
getUnit
public java.lang.String getUnit()
Description copied from interface:MetricInstrument
Returns the unit of measurement for the metric.- Specified by:
getUnit
in interfaceMetricInstrument
- Returns:
- the unit of measurement.
-
getRequiredLabelKeys
public java.util.List<java.lang.String> getRequiredLabelKeys()
Description copied from interface:MetricInstrument
Returns a list of required label keys for this metric instrument.- Specified by:
getRequiredLabelKeys
in interfaceMetricInstrument
- Returns:
- a list of required label keys.
-
getOptionalLabelKeys
public java.util.List<java.lang.String> getOptionalLabelKeys()
Description copied from interface:MetricInstrument
Returns a list of optional label keys for this metric instrument.- Specified by:
getOptionalLabelKeys
in interfaceMetricInstrument
- Returns:
- a list of optional label keys.
-
isEnableByDefault
public boolean isEnableByDefault()
Description copied from interface:MetricInstrument
Indicates whether this metric instrument is enabled by default.- Specified by:
isEnableByDefault
in interfaceMetricInstrument
- Returns:
true
if this metric instrument is enabled by default,false
otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-