spring-bootspring-boot-actuatorhealth-checkreadinessprobe

Why is the "readinessState" detail of /health different from the readiness probe status?


In Spring-Boot 2.4, I have this problem with the Actuator health endpoint and readiness probe. When one of my custom key components is down, the /health/readiness endpoint says DOWN and the /health endpoint too, but the readinessState detail of /health still says UP.

Why is it that way? Shouldn't readinessState say DOWN too?

None of the many tutorials I found online seem to address this question.

My hypothesis: the readinessState has nothing to do with readiness and exposes another piece of information. I hope I'm wrong, because it would be nonesense and what I understand of the code seems to indicate otherwise.


More about my configuration:

Relevant excerpt from application.yml

management:
  endpoints:
    web:
      base-path: /
  endpoint:
    health:
      show-details: ALWAYS
      probes:
        enabled: true
      group:
        readiness:
          include: db, myCustom, diskSpace

And when I make myCustom go DOWN, following results appear:

GET /health

{
    "status": "DOWN",
    "components": {
        ...,  // other components
        "myCustom": {
            "status": "DOWN"
        },
        "readinessState": {
            "status": "UP"  // here UP
        }
    },
    "groups": [
        "liveness",
        "readiness"
    ]
}

GET /health/readiness

{
    "status": "DOWN",  // but here DOWN
    "components": {
        ...,  // other components
        "myCustom": {
            "status": "DOWN"
        }
    }
}

Solution

  • The readiness state only monitors specific health groups. It needs to be told about your custom component.

    By default, Spring Boot does not add other Health Indicators to these groups.

    https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-kubernetes-probes-external-state