6

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.

h1h1
  • 730
  • 4
  • 11
  • 19

2 Answers2

1

I can think of two possibilities.

1) Create a custom HealthIndicator based on resilience4j's code: https://github.com/resilience4j/resilience4j/blob/master/resilience4j-spring-boot2/src/main/java/io/github/resilience4j/circuitbreaker/monitoring/health/CircuitBreakerHealthIndicator.java

You would need to return Health.up() or Health.unknown() to avoid the 503 from the /health endpoint.

2) Disable the resilience4j's health indicator and get the same information from the metrics actuator endpoint.

Macarse
  • 91,829
  • 44
  • 175
  • 230
1

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