Expand description
hyperlane-plugin-circuit-breaker
Lock-free atomic sliding-window HTTP circuit breaker plugin for Hyperlane
with route/prefix scoping, configurable failure-status predicates,
Closed -> Open -> HalfOpen probe gating, and prebuilt 503 responses.
Structs§
- Breaker
Rule - Per-route-prefix HTTP circuit-breaker policy.
- Breaker
Snapshot - Diagnostic point-in-time snapshot of one route-scoped circuit breaker.
- Circuit
Breaker Config - Top-level configuration collecting route-scoped
BreakerRuledefinitions. - Circuit
Breaker Engine - Compiled thread-safe HTTP circuit breaker engine backing
CircuitBreakerPlugin. - Circuit
Breaker Plugin - Process-wide
CircuitBreakerPluginsingleton holding aCircuitBreakerEngine. - Circuit
Breaker Request Hook - Opt-in request middleware short-circuiting open circuits with prebuilt
503wire responses. - Circuit
Breaker Response Hook - Opt-in response middleware recording final HTTP status codes into the matched circuit breaker.
- Half
Open Probe Guard - Leak-proof RAII probe handle carried by
BreakerPermit::HalfOpenProbe.
Enums§
- Breaker
Permit - Request tracking token stored in Hyperlane
Contextbetween request and response hooks. - Circuit
State - Operational state of a route-scoped HTTP circuit breaker.
Constants§
- ATTR_
CIRCUIT_ BREAKER_ TOKEN - Context attribute key storing the active circuit-breaker tracking token.
- DEFAULT_
BUCKET_ COUNT - Default number of atomic buckets partitioning the sliding window ring.
- DEFAULT_
FAILURE_ RATE_ THRESHOLD - Default failure-rate threshold (
0.5= 50% failures open the circuit). - DEFAULT_
HALF_ OPEN_ MAX_ PROBES - Default maximum concurrent probe requests admitted while
HalfOpen. - DEFAULT_
HALF_ OPEN_ SUCCESS_ THRESHOLD - Default consecutive probe successes required to close a
HalfOpencircuit. - DEFAULT_
MINIMUM_ REQUESTS - Default minimum requests in the sliding window before evaluating the failure rate.
- DEFAULT_
OPEN_ BODY - Default response body emitted when a circuit is open.
- DEFAULT_
OPEN_ CONTENT_ TYPE - Default
Content-Typeheader emitted on open-circuit503responses. - DEFAULT_
OPEN_ DURATION_ MS - Default cooldown duration in milliseconds while the circuit stays
Open(30 seconds). - DEFAULT_
RETRY_ AFTER_ SECS - Default
Retry-Afterheader value in seconds on open-circuit503responses. - DEFAULT_
WINDOW_ MS - Default sliding-window duration in milliseconds (10 seconds).
Type Aliases§
- Failure
Status Predicate - Thread-safe predicate deciding whether an HTTP response status code counts as a circuit failure.