Interface ResilienceMetrics
- All Known Implementing Classes:
FakeResilienceMetrics,MicrometerResilienceMetrics,NoOpMetrics,OpenTelemetryResilienceMetrics
public interface ResilienceMetrics
Backend-facing contract that concrete metrics implementations (Micrometer, OpenTelemetry, custom)
must implement to observe pattern and Policy events as metrics.
Implementation contract:
- Non-blocking: No I/O, no lock acquisition that could wait.
- Allocation-light: Avoid unnecessary object creation on the hot path.
- Virtual-thread-safe: Must not pin virtual threads in code resiliencia itself writes. This applies to the event→metric mapping code, not to any concrete backend registry the consuming application wires in at runtime.
Each backend implementation performs its own exhaustive switch over the sealed
Snapshot and Counters hierarchies inside its observe(...) method bodies,
guaranteed to compile only when all cases are handled.
-
Method Summary
Modifier and TypeMethodDescriptionvoidObserve a counter/timer-worthy occurrence from any pattern (Retry, Timeout, CircuitBreaker, Bulkhead, RateLimiter) or from Policy's order validation.voidObserve a gauge-worthy snapshot of live state from CircuitBreaker, Bulkhead, or RateLimiter.
-
Method Details
-
observe
Observe a gauge-worthy snapshot of live state from CircuitBreaker, Bulkhead, or RateLimiter.- Parameters:
snapshot- the snapshot to observe; never null
-
observe
Observe a counter/timer-worthy occurrence from any pattern (Retry, Timeout, CircuitBreaker, Bulkhead, RateLimiter) or from Policy's order validation.- Parameters:
counters- the counter event to observe; never null
-