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 Object implements MetricInstrument
A partial implementation of the MetricInstrument interface. This class provides common fields and functionality for metric instruments.
  • Field Details

    • index

      protected final int index
    • name

      protected final String name
    • description

      protected final String description
    • unit

      protected final String unit
    • requiredLabelKeys

      protected final List<String> requiredLabelKeys
    • optionalLabelKeys

      protected final List<String> optionalLabelKeys
    • enableByDefault

      protected final boolean enableByDefault
  • Constructor Details

    • PartialMetricInstrument

      protected PartialMetricInstrument(int index, String name, String description, String unit, List<String> requiredLabelKeys, List<String> optionalLabelKeys, boolean enableByDefault)
      Constructs a new PartialMetricInstrument with the specified attributes.
      Parameters:
      index - the unique index of this metric instrument
      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 for the metric
      optionalLabelKeys - a list of optional label keys for the metric
      enableByDefault - whether the metric should be enabled by default
  • Method Details

    • getIndex

      public int getIndex()
      Description copied from interface: MetricInstrument
      Returns the unique index of this metric instrument.
      Specified by:
      getIndex in interface MetricInstrument
      Returns:
      the index of the metric instrument.
    • getName

      public String getName()
      Description copied from interface: MetricInstrument
      Returns the name of the metric.
      Specified by:
      getName in interface MetricInstrument
      Returns:
      the name of the metric.
    • getDescription

      public String getDescription()
      Description copied from interface: MetricInstrument
      Returns a description of the metric.
      Specified by:
      getDescription in interface MetricInstrument
      Returns:
      a description of the metric.
    • getUnit

      public String getUnit()
      Description copied from interface: MetricInstrument
      Returns the unit of measurement for the metric.
      Specified by:
      getUnit in interface MetricInstrument
      Returns:
      the unit of measurement.
    • getRequiredLabelKeys

      public List<String> getRequiredLabelKeys()
      Description copied from interface: MetricInstrument
      Returns a list of required label keys for this metric instrument.
      Specified by:
      getRequiredLabelKeys in interface MetricInstrument
      Returns:
      a list of required label keys.
    • getOptionalLabelKeys

      public List<String> getOptionalLabelKeys()
      Description copied from interface: MetricInstrument
      Returns a list of optional label keys for this metric instrument.
      Specified by:
      getOptionalLabelKeys in interface MetricInstrument
      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 interface MetricInstrument
      Returns:
      true if this metric instrument is enabled by default, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object