Class MutableMeasurement

java.lang.Object
io.opentelemetry.sdk.metrics.internal.state.MutableMeasurement
All Implemented Interfaces:
Measurement

public final class MutableMeasurement extends Object implements Measurement
A mutable Measurement implementation

This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

This class is not thread-safe.

  • Field Details

    • startEpochNanos

      private long startEpochNanos
    • epochNanos

      private long epochNanos
    • hasLongValue

      private boolean hasLongValue
    • longValue

      private long longValue
    • hasDoubleValue

      private boolean hasDoubleValue
    • doubleValue

      private double doubleValue
    • attributes

      private Attributes attributes
  • Constructor Details

    • MutableMeasurement

      public MutableMeasurement()
  • Method Details

    • setDoubleMeasurement

      static void setDoubleMeasurement(MutableMeasurement mutableMeasurement, long startEpochNanos, long epochNanos, double value, Attributes attributes)
    • setLongMeasurement

      static void setLongMeasurement(MutableMeasurement mutableMeasurement, long startEpochNanos, long epochNanos, long value, Attributes attributes)
    • set

      private void set(long startEpochNanos, long epochNanos, boolean hasLongValue, long longValue, boolean hasDoubleValue, double doubleValue, Attributes attributes)
      Sets the values.
    • withStartEpochNanos

      public Measurement withStartEpochNanos(long startEpochNanos)
      Description copied from interface: Measurement
      Updates the startEpochNanos.
      Specified by:
      withStartEpochNanos in interface Measurement
      Parameters:
      startEpochNanos - start epoch nanosecond
      Returns:
      The updated object. For ImmutableMeasurement it will be a new object with the updated startEpochNanos and for MutableMeasurement it will return itself with the startEpochNanos updated
    • withAttributes

      public Measurement withAttributes(Attributes attributes)
      Description copied from interface: Measurement
      Updates the attributes.
      Specified by:
      withAttributes in interface Measurement
      Parameters:
      attributes - The attributes to update
      Returns:
      The updated object. For ImmutableMeasurement it will be a new object with the updated attributes and for MutableMeasurement it will return itself with the attributes updated
    • startEpochNanos

      public long startEpochNanos()
      Specified by:
      startEpochNanos in interface Measurement
    • epochNanos

      public long epochNanos()
      Specified by:
      epochNanos in interface Measurement
    • hasLongValue

      public boolean hasLongValue()
      Specified by:
      hasLongValue in interface Measurement
    • longValue

      public long longValue()
      Specified by:
      longValue in interface Measurement
    • hasDoubleValue

      public boolean hasDoubleValue()
      Specified by:
      hasDoubleValue in interface Measurement
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in interface Measurement
    • attributes

      public Attributes attributes()
      Specified by:
      attributes in interface Measurement