Class OpenTelemetryResilienceMetrics
java.lang.Object
io.github.teceli.resiliencia.opentelemetry.OpenTelemetryResilienceMetrics
- All Implemented Interfaces:
ResilienceMetrics
ResilienceMetrics backed by an OpenTelemetry Meter.
Duration metrics (resilience.timeout.duration, resilience.circuitbreaker.calls)
are recorded according to the configured DurationInstrumentationMode — SAFE
(default, lock-free counter pair) or DETAILED (opt-in, DoubleHistogram, see that
enum's Javadoc for the pinning risk it accepts).
Every metric emitted here is tagged with the pattern instance's name (the
"name" attribute key). That name must be a static, compile-time-known string — never
request-derived or tenant-derived — since it becomes a cardinality-bounded attribute value in
the OpenTelemetry SDK; unbounded distinct names would cause unbounded memory growth in the
metrics backend.
-
Constructor Summary
ConstructorsConstructorDescriptionOpenTelemetryResilienceMetrics(io.opentelemetry.api.metrics.Meter meter) OpenTelemetryResilienceMetrics(io.opentelemetry.api.metrics.Meter meter, DurationInstrumentationMode durationMode) -
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.
-
Constructor Details
-
OpenTelemetryResilienceMetrics
public OpenTelemetryResilienceMetrics(io.opentelemetry.api.metrics.Meter meter) -
OpenTelemetryResilienceMetrics
public OpenTelemetryResilienceMetrics(io.opentelemetry.api.metrics.Meter meter, DurationInstrumentationMode durationMode)
-
-
Method Details
-
observe
Description copied from interface:ResilienceMetricsObserve a gauge-worthy snapshot of live state from CircuitBreaker, Bulkhead, or RateLimiter.- Specified by:
observein interfaceResilienceMetrics- Parameters:
snapshot- the snapshot to observe; never null
-
observe
Description copied from interface:ResilienceMetricsObserve a counter/timer-worthy occurrence from any pattern (Retry, Timeout, CircuitBreaker, Bulkhead, RateLimiter) or from Policy's order validation.- Specified by:
observein interfaceResilienceMetrics- Parameters:
counters- the counter event to observe; never null
-