ChaosConfig
class ChaosConfig
Configuration for the chaos policy, used to inject faults, latency, or overridden results into an operation for testing and resilience validation.
Production safeguard: enabled defaults to false. The chaos wrapper is only installed when enabled is explicitly set to true. This ensures zero overhead in production.
Example:
resilient(scope) {
chaos {
enabled = true
failureRate = 0.3 // 30% of calls throw
latency = 200.milliseconds // inject 200ms delay before every call
exception = { IOException("chaos: simulated network failure") }
}
}Content copied to clipboard