Interface Counter

All Known Implementing Classes:
DefaultCounter

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

    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 Link icon

    • increment Link icon

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

      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 Link icon

      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 Link icon

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

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

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