Interface Counter

  • All Known Implementing Classes:
    DefaultCounter

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

      • 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.