java.lang.Object
io.github.teceli.resiliencia.metrics.NoOpMetrics
All Implemented Interfaces:
ResilienceMetrics

public final class NoOpMetrics extends Object implements ResilienceMetrics
A no-op ResilienceMetrics implementation that discards all recordings. Used by default when no backend is configured, to avoid null-checking or forcing consumers to provide a metrics implementation they may not need.

Thread-safe and lock-free. Suitable for use as a default or when metrics are deliberately disabled.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final NoOpMetrics
    Singleton instance of the no-op metrics implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    observe(Counters counters)
    Observe a counter/timer-worthy occurrence from any pattern (Retry, Timeout, CircuitBreaker, Bulkhead, RateLimiter) or from Policy's order validation.
    void
    observe(Snapshot snapshot)
    Observe a gauge-worthy snapshot of live state from CircuitBreaker, Bulkhead, or RateLimiter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INSTANCE

      public static final NoOpMetrics INSTANCE
      Singleton instance of the no-op metrics implementation.
  • Method Details

    • observe

      public void observe(Snapshot snapshot)
      Description copied from interface: ResilienceMetrics
      Observe a gauge-worthy snapshot of live state from CircuitBreaker, Bulkhead, or RateLimiter.
      Specified by:
      observe in interface ResilienceMetrics
      Parameters:
      snapshot - the snapshot to observe; never null
    • observe

      public void observe(Counters counters)
      Description copied from interface: ResilienceMetrics
      Observe a counter/timer-worthy occurrence from any pattern (Retry, Timeout, CircuitBreaker, Bulkhead, RateLimiter) or from Policy's order validation.
      Specified by:
      observe in interface ResilienceMetrics
      Parameters:
      counters - the counter event to observe; never null