Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 289
h1h1 Avatar asked Apr 23 '19 13:04

h1h1


People also ask

What is CircuitBreaker resilience4j?

The CircuitBreaker uses a sliding window to store and aggregate the outcome of calls. You can choose between a count-based sliding window and a time-based sliding window. The count-based sliding window aggregrates the outcome of the last N calls.

What does spring actuator do?

Spring Boot's 'Actuator' dependency is used to monitor and manage the Spring web application. We can use it to monitor and manage the application with the help of HTTP endpoints or with the JMX.

What is spring actuator health check?

Spring Boot Actuator module helps you monitor and manage your Spring Boot application by providing production-ready features like health check-up, auditing, metrics gathering, HTTP tracing etc. All of these features can be accessed over JMX or HTTP endpoints.

Why spring actuator is not working?

Spring Boot Actuator is not working because the spring boot actuator dependency is incorrect or the actuator isn't configured properly in the application. properties file. If the spring boot starter actuator is not configured, endpoints like health, info, shutdown, refresh, env, and metrics may not work.


1 Answers

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

like image 110
nikos912000 Avatar answered Oct 15 '22 03:10

nikos912000