config

package
v0.0.0-...-5f5656b Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTimeout is how long to wait for command to complete, in milliseconds
	DefaultTimeout = 1000
	// DefaultMaxConcurrent is how many commands can run at the same time in an executor pool
	DefaultMaxConcurrent = 10
	// DefaultVolumeThreshold is the minimum number of requests needed before a circuit can be tripped due to health
	DefaultVolumeThreshold = 20
	// DefaultSleepWindow is how long, in milliseconds, to wait after a circuit opens before testing for recovery
	DefaultSleepWindow = 5000
	// DefaultErrorPercentThreshold causes circuits to open once the rolling measure of errors exceeds this percent of requests
	DefaultErrorPercentThreshold = 50
)

Functions

func Configure

func Configure(cmds map[string]CommandConfig)

Configure applies settings for a set of circuits

func ConfigureCommand

func ConfigureCommand(name string, config CommandConfig)

ConfigureCommand applies settings for a circuit

func GetCircuitConfigMap

func GetCircuitConfigMap() map[string]*Config

Types

type CommandConfig

type CommandConfig struct {
	Timeout                int `json:"timeout"`
	MaxConcurrentRequests  int `json:"max_concurrent_requests"`
	RequestVolumeThreshold int `json:"request_volume_threshold"`
	SleepWindow            int `json:"sleep_window"`
	ErrorPercentThreshold  int `json:"error_percent_threshold"`
}

CommandConfig is used to tune circuit settings at runtime

type Config

type Config struct {
	Timeout                time.Duration
	MaxConcurrentRequests  int
	SleepWindow            time.Duration
	RequestVolumeThreshold uint64
	ErrorPercentThreshold  int
}

func GetCircuitConfig

func GetCircuitConfig(name string) *Config

GetCircuitConfig get the config of the circuit by name

Jump to

Keyboard shortcuts

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