hystrix

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hystrix

Package hystrix

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBreaker

func NewBreaker(name string, opts ...Option) circuitbreaker.Breaker

Types

type Option

type Option func(breaker *breaker)

func WithErrorPercentThreshold

func WithErrorPercentThreshold(errorPercentThreshold int) Option

WithErrorPercentThreshold 错误百分比,默认值是50(当错误百分比超过这个限制时则进行熔断)。请求数量大于等于RequestVolumeThreshold并且错误率到达这个百分比后就会启动熔断

func WithMaxConcurrentRequests

func WithMaxConcurrentRequests(maxConcurrentRequests int) Option

WithMaxConcurrentRequests 最大并发量,默认值是10

func WithRequestVolumeThreshold

func WithRequestVolumeThreshold(requestVolumeThreshold int) Option

WithRequestVolumeThreshold 一个统计窗口10秒内请求数量。达到这个请求数量后才去判断是否要开启熔断,默认值是20(比如10秒内接到了11个请求只超过了1个)

func WithSleepWindow

func WithSleepWindow(sleepWindow int) Option

WithSleepWindow 熔断后多久去尝试服务是否可用,默认值是5000毫秒(熔断器打开到半打开的时间),milliseconds

func WithTimeout

func WithTimeout(timeout int) Option

WithTimeout 单次请求超时时间,默认时间是1000毫秒,milliseconds

Jump to

Keyboard shortcuts

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