我设置了以下属性:
HystrixCommandProperties.Setter commandProperties =
HystrixCommandProperties.Setter();
commandProperties.withCircuitBreakerSleepWindowInMilliseconds(20000);
commandProperties.withMetricsRollingStatisticalWindowInMilliseconds(30000);
commandProperties.withCircuitBreakerErrorThresholdPercentage(40);
commandProperties.withCircuitBreakerRequestVolumeThreshold(10);
HystrixCommand.Setter config = HystrixCommand
.Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey("KEY"));
config.andCommandPropertiesDefaults(commandProperties);
在 hystrix 仪表板上观察到,电路在打开和关闭之间波动几秒钟,然后稳定到打开状态,然后进入睡眠窗口。我的理解是,在第一次打开后,所有请求都应该回退,电路应该保持打开状态,直到睡眠窗口过去,之后它应该检查并恢复各自的状态。开盘和收盘之间的波动不符合我的理解。