Documentation ¶
Index ¶
- type Breaker
- type BreakerAfterFunc
- type BreakerConf
- type BreakerOption
- func WithBreakerAfterFunc(b BreakerAfterFunc) BreakerOption
- func WithBreakerEnable(en bool) BreakerOption
- func WithCommandPrefix(prefix string) BreakerOption
- func WithDatadogClient(client *statsd.Client) BreakerOption
- func WithErrorPercentageThreshold(count int) BreakerOption
- func WithMaxConcurrentRequests(count int) BreakerOption
- func WithMetricsCollector(metrics metrics.Provider) BreakerOption
- func WithRequestVolumeThreshold(count int) BreakerOption
- func WithSleepWindow(inmils int) BreakerOption
- func WithTimeout(inmils int) BreakerOption
- type Commander
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Breaker ¶
type Breaker struct {
// contains filtered or unexported fields
}
Breaker wraps the endpointer and the command config required for the hysterix
func NewBreaker ¶
func NewBreaker(fn endpoint.Endpoint, opts ...BreakerOption) (*Breaker, error)
NewBreaker returns a circuit breaker
func NewBreakerFromConfig ¶
func NewBreakerFromConfig( fn endpoint.Endpoint, lg log.Logger, cfg *BreakerConf, opts ...BreakerOption, ) (*Breaker, error)
NewBreakerFromConfig builds breaker from config
type BreakerAfterFunc ¶
type BreakerAfterFunc func(req interface{}, res interface{}, err error)
type BreakerConf ¶
type BreakerOption ¶
BreakerOption is options that modify the Breaker
func WithBreakerAfterFunc ¶
func WithBreakerAfterFunc(b BreakerAfterFunc) BreakerOption
func WithBreakerEnable ¶
func WithBreakerEnable(en bool) BreakerOption
WithBreakerEnable sets if the breaker is enabled
func WithCommandPrefix ¶
func WithCommandPrefix(prefix string) BreakerOption
WithCommandPrefix sets the prefix for the hysterix command
func WithDatadogClient ¶
func WithDatadogClient(client *statsd.Client) BreakerOption
WithDatadogClient sets custom datadog event emitter for Tolerance
func WithErrorPercentageThreshold ¶
func WithErrorPercentageThreshold(count int) BreakerOption
WithErrorPercentageThreshold the percentage threshold beyond which the circuit will be deemed open
func WithMaxConcurrentRequests ¶
func WithMaxConcurrentRequests(count int) BreakerOption
WithMaxConcurrentRequests sets configuration for max concurrent requests supported for a given command
func WithMetricsCollector ¶
func WithMetricsCollector(metrics metrics.Provider) BreakerOption
WithMetricsCollector sets the breaker with go-base metrics event emitter
func WithRequestVolumeThreshold ¶
func WithRequestVolumeThreshold(count int) BreakerOption
WithRequestVolumeThreshold sets the minimum number of request needed before the circuit can be tripped
func WithSleepWindow ¶
func WithSleepWindow(inmils int) BreakerOption
WithSleepWindow sets the time in millisecond to wait after a circuit opens for testing for recovery
func WithTimeout ¶
func WithTimeout(inmils int) BreakerOption
WithTimeout returns a circuit breaker with a given timeout