Interface Counter

All Known Implementing Classes:
DefaultCounter

public interface Counter
Generalized Counter interface for creating telemetry-related instances when counting events.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Increment the counter by 1.
    default void
    increment(int amount)
    Increment the counter by the provided amount.
    void
    increment(long amount)
    Increment the counter by the provided amount.
    default boolean
    Determines whether this counter is a NOOP counter.
    The unit of the counter.
    long
    Reports the current count.
  • Method Details

    • increment

      void increment()
      Increment the counter by 1.
    • increment

      default void increment(int amount)
      Increment the counter by the provided amount.

      Implementations may skip the overflow check for better write throughput.

      Parameters:
      amount - to be incremented.
    • increment

      void increment(long amount)
      Increment the counter by the provided amount.

      Implementations may skip the overflow check for better write throughput.

      Parameters:
      amount - to be incremented.
    • value

      long value()
      Reports the current count.
      Returns:
      The current count.
    • unit

      default MetricsContext.Unit unit()
      The unit of the counter.
      Returns:
      The unit of the counter.
    • isNoop

      default boolean isNoop()
      Determines whether this counter is a NOOP counter.
      Returns:
      Whether this counter is a NOOP counter.