Documentation ¶
Overview ¶
Package gobreaker provides a circuit breaker adapter using the sony/gobreaker lib.
Sample backend extra config
... "extra_config": { ... "github.com/devopsfaith/krakend-circuitbreaker/gobreaker": { "interval": 60, "timeout": 10, "max_errors": 5, "log_status_change": true, }, ... }, ...
The gobreaker package provides an efficient circuit breaker implementation. See https://github.com/sony/gobreaker and https://martinfowler.com/bliki/CircuitBreaker.html for more details.
Index ¶
Constants ¶
View Source
const Namespace = "github.com/davron112/krakend-circuitbreaker/gobreaker"
Namespace is the key to use to store and access the custom config data
Variables ¶
View Source
var ZeroCfg = Config{}
ZeroCfg is the zero value for the Config struct
Functions ¶
func ConfigGetter ¶
func ConfigGetter(e config.ExtraConfig) interface{}
ConfigGetter implements the config.ConfigGetter interface. It parses the extra config for the gobreaker adapter and returns a ZeroCfg if something goes wrong.
func NewCircuitBreaker ¶
func NewCircuitBreaker(cfg Config, logger logging.Logger) *gobreaker.CircuitBreaker
NewCircuitBreaker builds a gobreaker circuit breaker with the injected config
Types ¶
Click to show internal directories.
Click to hide internal directories.