gobreaker

package
v2.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 5 Imported by: 1

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/devopsfaith/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

type Config

type Config struct {
	Name            string
	Interval        int
	Timeout         int
	MaxErrors       int
	LogStatusChange bool
}

Config is the custom config struct containing the params for the sony/gobreaker package

Directories

Path Synopsis
Package gobreaker provides a circuit breaker proxy middleware using the sony/gobreaker lib.
Package gobreaker provides a circuit breaker proxy middleware using the sony/gobreaker lib.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL