In a circuit breaker setup using resilience4j, the Circuit Breaker goes from CLOSED to HALF_OPEN directly without going to OPEN. Not just this, this happens when we are not providing the success of failure metrics to it. Two things are not clear here:
- How can the Circuit Breaker change its state when no metrics is provided to the same about the success or failure?
- What is the behavior of the circuit breaker going from CLOSED to HALF_OPEN, as theoretically it must go from CLOSED to OPEN and then to HALF_OPEN after the waiting period ?
If no metrics are provided, CB uses the timeout mechanism to change its state. The circuit breaker uses fixed timeout value for each request on its own. If the external service call takes more time than the timeout value (example 100ms for each request) for responding, then it moves to OPEN after tripping.
One possibility is if Retry is used in circuit breaker implementation. CB transition from CLOSED to HALF OPEN directly instead of OPEN due to retry logic to handle failure calls.