3

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"
        }
    }
}
AdrienW
  • 3,092
  • 6
  • 29
  • 59

1 Answers1

5

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

Abhijit Sarkar
  • 21,927
  • 20
  • 110
  • 219
  • Ok, so `readinessState` is just the "default" basic readiness information without dependencies? and I can include it in the readiness group with my custom checks to have the correct picture in the readiness probe? – AdrienW Feb 01 '21 at 10:28
  • 1
    By custom check, if you mean a health check that you implemented, then all you need is `management.endpoint.health.group.readiness.include=readinessState,customCheck`. – Abhijit Sarkar Feb 01 '21 at 10:36