Documentation
¶
Overview ¶
Package hystrix provides hystrix filter.
Index ¶
Constants ¶
View Source
const (
// nolint
HYSTRIX = "hystrix"
)
Variables ¶
This section is empty.
Functions ¶
func NewHystrixFilterError ¶
NewHystrixFilterError return a FilterError instance
Types ¶
type CommandConfigWithError ¶
type CommandConfigWithError struct {
Timeout int `yaml:"timeout"`
MaxConcurrentRequests int `yaml:"max_concurrent_requests"`
RequestVolumeThreshold int `yaml:"request_volume_threshold"`
SleepWindow int `yaml:"sleep_window"`
ErrorPercentThreshold int `yaml:"error_percent_threshold"`
Error []string `yaml:"error_whitelist"`
}
nolint
type Filter ¶
type Filter struct {
COrP bool // true for consumer
// contains filtered or unexported fields
}
Filter for Hystrix *
- You should add hystrix related configuration in provider or consumer config or both, according to which side you are to apply Filter.
- For example:
- filter_conf:
- hystrix:
- configs:
- # =========== Define config here ============
- "Default":
- timeout : 1000
- max_concurrent_requests : 25
- sleep_window : 5000
- error_percent_threshold : 50
- request_volume_threshold: 20
- "userp":
- timeout: 2000
- max_concurrent_requests: 512
- sleep_window: 4000
- error_percent_threshold: 35
- request_volume_threshold: 6
- "userp_m":
- timeout : 1200
- max_concurrent_requests : 512
- sleep_window : 6000
- error_percent_threshold : 60
- request_volume_threshold: 16
- # =========== Define error whitelist which will be ignored by Hystrix counter ============
- error_whitelist: [".*exception.*"] *
- # =========== Apply default config here ===========
- default: "Default" *
- services:
- "com.ikurento.user.UserProvider":
- # =========== Apply service level config ===========
- service_config: "userp"
- # =========== Apply method level config ===========
- methods:
- "GetUser": "userp_m"
- "GetUser1": "userp_m"
type FilterConfig ¶
type FilterConfig struct {
Configs map[string]*CommandConfigWithError
Default string
Services map[string]ServiceHystrixConfig
}
nolint
type FilterError ¶
type FilterError struct {
// contains filtered or unexported fields
}
FilterError implements error interface
func (*FilterError) Error ¶
func (hfError *FilterError) Error() string
func (*FilterError) FailByHystrix ¶
func (hfError *FilterError) FailByHystrix() bool
FailByHystrix returns whether the fails causing by Hystrix
type ServiceHystrixConfig ¶
type ServiceHystrixConfig struct {
ServiceConfig string `yaml:"service_config"`
Methods map[string]string
}
nolint
Click to show internal directories.
Click to hide internal directories.