Documentation
¶
Overview ¶
Package circuitbreaking implements the circuit breaker pattern for managing service availability and preventing cascading failures.
The breaker itself lives in circuitbreaking/config, which builds one from a Config and wires its state changes to the pillars: a trip and a reset are each logged and counted, while the individual failures behind them are only counted — a dependency that is down produces one failure per attempt for as long as it stays down, and the trip is the event those are evidence for.
Every measurement carries the breaker's name as an attribute rather than in the instrument name, so one breaker's trips can be read on their own and every breaker's trips can be read together. Name your breakers: an unnamed one is given a numbered placeholder, which is enough to keep two of them out of the same series and no help at all to whoever reads the series later.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrCircuitBroken = errors.New("service circuit broken")
ErrCircuitBroken is returned when a circuit breaker has tripped.
Functions ¶
This section is empty.
Types ¶
type CircuitBreaker ¶
CircuitBreaker tracks failures and successes to determine whether an operation should proceed.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package circuitbreakingcfg builds a circuitbreaking.CircuitBreaker from configuration.
|
Package circuitbreakingcfg builds a circuitbreaking.CircuitBreaker from configuration. |
|
Package circuitbreakingmock provides moq-generated mock implementations of the circuitbreaking package's interfaces.
|
Package circuitbreakingmock provides moq-generated mock implementations of the circuitbreaking package's interfaces. |
|
Package noop is the circuitbreaking.CircuitBreaker that never opens: CanProceed is always true, no matter how many failures are reported to it.
|
Package noop is the circuitbreaking.CircuitBreaker that never opens: CanProceed is always true, no matter how many failures are reported to it. |
|
Package partitioned provides a circuit breaker that is partitioned by key.
|
Package partitioned provides a circuit breaker that is partitioned by key. |
|
config
Package partitionedcfg builds a partitioned.KeyedCircuitBreaker from one base circuitbreakingcfg.Config: a breaker per declared key, plus a global one that every undeclared key shares.
|
Package partitionedcfg builds a partitioned.KeyedCircuitBreaker from one base circuitbreakingcfg.Config: a breaker per declared key, plus a global one that every undeclared key shares. |
|
mock
Package partitionedmock provides a moq-generated mock implementation of the partitioned package's KeyedCircuitBreaker interface.
|
Package partitionedmock provides a moq-generated mock implementation of the partitioned package's KeyedCircuitBreaker interface. |
|
noop
Package noop is the partitioned.KeyedCircuitBreaker that never opens for any key.
|
Package noop is the partitioned.KeyedCircuitBreaker that never opens for any key. |