Record Class InstrumentOptions

java.lang.Object
java.lang.Record
codes.grow.packages.otelcollector.InstrumentOptions
Record Components:
description - instrument description, may be null
unit - UCUM unit such as ms, By or {request}, may be null
meter - meter to create the instrument on, null for OtelCollectorMetrics.DEFAULT_METER_NAME
boundaries - explicit histogram bucket boundaries (ascending, advice to the SDK), may be empty

public record InstrumentOptions(String description, String unit, String meter, List<Double> boundaries) extends Record
Options of the metric instrument helpers (counter, upDownCounter, histogram, gauge).
  • Field Details

    • NONE

      public static final InstrumentOptions NONE
      No description, unit, meter or boundaries.
  • Constructor Details

    • InstrumentOptions

      public InstrumentOptions(String description, String unit, String meter, List<Double> boundaries)
      Copies the boundaries.
      Parameters:
      description - description
      unit - unit
      meter - meter name
      boundaries - boundaries
  • Method Details

    • unit

      public static InstrumentOptions unit(String unit)
      Options with a unit only.
      Parameters:
      unit - unit
      Returns:
      the options
    • boundaries

      public static InstrumentOptions boundaries(Double... boundaries)
      Histogram options with explicit bucket boundaries.
      Parameters:
      boundaries - ascending boundaries
      Returns:
      the options
    • withDescription

      public InstrumentOptions withDescription(String description)
      Returns a copy with a description.
      Parameters:
      description - description
      Returns:
      the options
    • withUnit

      public InstrumentOptions withUnit(String unit)
      Returns a copy with a unit.
      Parameters:
      unit - unit
      Returns:
      the options
    • withMeter

      public InstrumentOptions withMeter(String meter)
      Returns a copy that creates the instrument on another meter.
      Parameters:
      meter - meter name
      Returns:
      the options
    • withBoundaries

      public InstrumentOptions withBoundaries(List<Double> boundaries)
      Returns a copy with histogram bucket boundaries.
      Parameters:
      boundaries - ascending boundaries
      Returns:
      the options
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • unit

      public String unit()
      Returns the value of the unit record component.
      Returns:
      the value of the unit record component
    • meter

      public String meter()
      Returns the value of the meter record component.
      Returns:
      the value of the meter record component
    • boundaries

      public List<Double> boundaries()
      Returns the value of the boundaries record component.
      Returns:
      the value of the boundaries record component