ResilientEvent

sealed interface ResilientEvent

Represents a set of telemetry events that can be emitted by resilience policies during the execution of an operation.

These events provide insights into the behavior of policies like Retry, Circuit Breaker, Rate Limiter, and Bulkhead. Consumers can collect and process these events to monitor system health, diagnose issues, or trigger alerts.

Inheritors

Types

Link copied to clipboard
data class BulkheadRejected(val reason: String) : ResilientEvent

Emitted when a call is rejected by the bulkhead due to capacity constraints.

Link copied to clipboard
data class CacheHit(val key: String) : ResilientEvent

Emitted when the cache returns a valid entry (hit).

Link copied to clipboard
data class CacheMiss(val key: String) : ResilientEvent

Emitted when the cache does not have a valid entry and the block is executed (miss).

Link copied to clipboard

Emitted when the circuit breaker changes its state.

Link copied to clipboard
data class FallbackTriggered(val error: Throwable) : ResilientEvent

Emitted when the fallback is used after the operation failed.

Link copied to clipboard
data class HedgingUsed(val attemptIndex: Int) : ResilientEvent

Emitted when hedging returns a result from a non-primary attempt (attempt index > 0).

Link copied to clipboard
data class OperationFailure(val error: Throwable, val duration: Duration) : ResilientEvent

Emitted after a failed operation, capturing the triggering error and the execution duration.

Link copied to clipboard
data class OperationSuccess(val duration: Duration) : ResilientEvent

Emitted after a successful operation, including the total time taken for the execution.

Link copied to clipboard
data class RateLimited(val waitTime: Duration) : ResilientEvent

Emitted when execution is rate limited; includes the suggested wait time before the next attempt.

Link copied to clipboard
data class RetryAttempt(val attempt: Int, val error: Throwable) : ResilientEvent

Emitted on each retry attempt.

Link copied to clipboard
data class TimeoutTriggered(val timeout: Duration) : ResilientEvent

Emitted when the operation exceeds the configured timeout and is cancelled.