Interface BoundDoubleCounter


@ThreadSafe public interface BoundDoubleCounter
A DoubleCounter bound to a fixed set of Attributes, obtained via ExtendedDoubleCounter.bind(Attributes).

Binding resolves the underlying timeseries once, so subsequent add(double) calls record directly without the per-recording attribute processing and map lookup that DoubleCounter.add(double, Attributes) performs. This is useful when the set of attribute combinations is known ahead of time and the same series is recorded to repeatedly.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(double value)
    Records a value against the bound attributes.
    void
    add(double value, io.opentelemetry.context.Context context)
    Records a value against the bound attributes, with an explicit Context.
  • Method Details

    • add

      void add(double value)
      Records a value against the bound attributes.

      Note: This may use Context.current() to pull the context associated with this measurement.

      Parameters:
      value - The increment amount. MUST be non-negative.
    • add

      void add(double value, io.opentelemetry.context.Context context)
      Records a value against the bound attributes, with an explicit Context.
      Parameters:
      value - The increment amount. MUST be non-negative.
      context - The explicit context to associate with this measurement.