Documentation ¶
Index ¶
Constants ¶
View Source
const ( Closed int32 = iota Open HalfOpen )
Valid CircuitState values.
View Source
const PkgName = "auxo.apm.breaker"
Variables ¶
View Source
var ( // ErrMaxConcurrency occurs when too many of the same named command are executed at the same time. ErrMaxConcurrency = errors.New("breaker: max concurrency") // ErrCircuitOpen returns when an execution attempt "short circuits". This happens due to the circuit being measured as unhealthy. ErrCircuitOpen = errors.New("breaker: circuit open") // ErrTimeout occurs when the provided function takes too long to execute. ErrTimeout = errors.New("breaker: timeout") )
Functions ¶
This section is empty.
Types ¶
type Condition ¶
Condition is a monitor for circuit, it return true if should open circuit.
func ConsecutiveErrorCount ¶
func ErrorCount ¶
type Options ¶
type Options struct { // Window is how long to wait for state switched to half-open from open. Window time.Duration // Timeout is how long to wait for action to complete. Timeout time.Duration // Concurrency is how many actions can execute at the same time. If concurrency is zero, no limitation is set. Concurrency int32 }
Options holds options of Breaker
type Summary ¶
type Summary interface { // Total is total attempts Total() uint32 // Success is success count Success() uint32 // Failure is failure count Failure() uint32 // Intercept is failure count with ErrCircuitOpen Intercept() uint32 // Reject is failure count with ErrMaxConcurrency Reject() uint32 // Timeout is failure count with ErrTimeout Timeout() uint32 // FallbackSuccess is success count by fallback FallbackSuccess() uint32 // FallbackFailure is failure count by fallback FallbackFailure() uint32 }
Summary represents statistics of Breaker.
Click to show internal directories.
Click to hide internal directories.