hystrix

package module
v0.0.0-...-f0ccf61 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Breaker

func Breaker(opts ...Option) goreq.HandlerFunc

Types

type CommandConfig

type CommandConfig struct {
	Timeout                int `json:"timeout"`                  // how long to wait for command to complete, in milliseconds, default 1000
	MaxConcurrentRequests  int `json:"max_concurrent_requests"`  // how many commands of the same type can run at the same time, default 10
	RequestVolumeThreshold int `json:"request_volume_threshold"` // the minimum number of requests needed before a circuit can be tripped due to health, default 20
	SleepWindow            int `json:"sleep_window"`             // how long, in milliseconds, to wait after a circuit opens before testing for recovery, default 5000
	ErrorPercentThreshold  int `json:"error_percent_threshold"`  // causes circuits to open once the rolling measure of errors exceeds this percent of requests, default 50
}

type Option

type Option func(*Options)

func ConfigureCommand

func ConfigureCommand(name string, config CommandConfig) Option

func DefaultErrorPercentThreshold

func DefaultErrorPercentThreshold(errorPercentThreshold int) Option

func DefaultMaxConcurrentRequests

func DefaultMaxConcurrentRequests(maxConcurrentRequests int) Option

func DefaultRequestVolumeThreshold

func DefaultRequestVolumeThreshold(requestVolumeThreshold int) Option

func DefaultSleepWindow

func DefaultSleepWindow(sleepWindow int) Option

func DefaultTimeout

func DefaultTimeout(timeout int) Option

func KeyFunc

func KeyFunc(keyFunc func(request *goreq.Req) string) Option

type Options

type Options struct {
	KeyFunc  func(request *goreq.Req) string
	Commands map[string]hystrix.CommandConfig
}

Jump to

Keyboard shortcuts

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