Search code examples
spring-boot-actuatorresilience4j

Resilience4j and Spring Actuator - Open circuit killing service


I have added the following dependency to my Spring Boot project

implementation 'io.github.resilience4j:resilience4j-spring-boot2:0.14.1'

When a circuit breaker opens, I get the following response on my actuator/health endpoint, with status code 503 Service Unavailable:

{
"status": "DOWN",
"details": {
    "diskSpace": {
        "status": "UP",
        "details": {
            "total": 499963174912,
            "free": 432263229440,
            "threshold": 10485760
        }
    },
    "refreshScope": {
        "status": "UP"
    },
    "getFlightInfoCircuitBreaker": {
        "status": "DOWN",
        "details": {
            "failureRate": "100.0%",
            "failureRateThreshold": "2.0%",
            "maxBufferedCalls": 1,
            "bufferedCalls": 1,
            "failedCalls": 1,
            "notPermittedCalls": 1,
            "state": "OPEN"
        }
    }
}

}

My AWS ECS container health check uses this endpoint to determine its health, and restarts the container on a non-200 response.

As I do not want my service to be restarted when a circuit breaker opens, is there a way to have a circuit breaker being open, without causing the status of the service to be down?

I am aware of the registerHealthIndicator: false property to get round this issue, but this removes the circuit breaker stats from actuator, which I would still like to see.


Solution

  • Since 1.2.0 you can set the allowHealthIndicatorToFail to false for this.