Issue with minimum number of calls
See original GitHub issueResilience4j version: 1.7.0
Java version: 1.8
I have below set of properties in my application.properties for resilience4j.
resilience4j.circuitbreaker.instances.myService.minimum-number-of-calls=10 resilience4j.circuitbreaker.instances.myService.sliding-window-size=5 resilience4j.circuitbreaker.instances.myService.failure-rate-threshold=50 resilience4j.circuitbreaker.instances.myService.wait-duration-in-open-state=30000 resilience4j.circuitbreaker.instances.myService.automatic-transition-from-open-to-half-open-enabled=true resilience4j.circuitbreaker.instances.myService.permitted-number-of-calls-in-half-open-state=5
I am having below annotation over my method.
@CircuitBreaker(name = "myService", fallbackMethod = "myServiceFallback")
I am having other service down and want to make all calls as failure.
As per doc even if all 9 calls are failures circuit will NOT go to open state. But in my case I am having first 6 failures in a raw. So total calls recorded are 6 and total failures are also 6. After 5th failure its going into open state. The 6th failure is giving me exception as io.github.resilience4j.circuitbreaker.CallNotPermittedException
It should go to open state after 10th failure.
I am not getting why this is happening ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
No
If you set
sliding-window-size
greater thanminimum-number-of-calls
, CircuitBreakerState take your config as it. But if you setsliding-window-size
less thanminimum-number-of-calls
, CircuitBreakerState takesliding-window-size
asminimum-number-of-calls
Below is our implementation that I explained. https://github.com/resilience4j/resilience4j/blob/9ffb76906ac45d48cbcc0b1876d139eda9400d3e/resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/CircuitBreakerMetrics.java#L48-L51
because u r setting ur window size to 5 here : resilience4j.circuitbreaker.instances.myService.sliding-window-size=5