Skip to content
Advertisement

management.endpoint.health.group.readiness.include=* bug – Spring Boot Actuator

A bug in Spring Boot Actuator exists whereby if certain properties are used, management.endpoint.health.probes.add-additional-paths=true doesn’t work in exposing the readiness endpoint at /readyz and the liveness endpoint at /livez. You get a whitelabel error page.

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Those properties include:

management.endpoint.health.group.readiness.include=
management.endpoint.health.group.liveness.include=
management.endpoint.health.group.liveness.show-details=
management.endpoint.health.group.readiness.show-details=

I need to use the management port by default so that I can use /actuator/metrics for monitoring. Therefore, in order to have reliable health checks, I need to expose the liveness and readiness endpoints on the main/application port, this is what the purpose of management.endpoint.health.probes.add-additional-paths=true is.

If I can’t include additional checks in my readiness health check due to this bug, Spring Boot Actuator becomes unusable to me. Is there a workaround that can allow additional checks to be included while still allowing the readiness and liveness endpoints to be successfully exposed on the main/application port?

I have already tried using management.endpoint.health.group.readiness.additional-path=server:/readyz. This does not work.

I am using Spring Boot version 2.6.5.

Advertisement

Answer

You can make the liveness and readiness health groups available at :8080/livez and :8080/readyz respectively with full details using the following configuration:

management.endpoint.health.group.liveness.additional-path=server:/livez
management.endpoint.health.group.liveness.show-details=always
management.endpoint.health.group.readiness.additional-path=server:/readyz
management.endpoint.health.group.readiness.show-details=always
$ curl localhost:8080/livez
{"status":"UP","components":{"diskSpace":{"status":"UP","details":{"total":1000240963584,"free":468848824320,"threshold":10485760,"exists":true}},"livenessState":{"status":"UP"},"ping":{"status":"UP"},"readinessState":{"status":"UP"}}}

This shows the same information as the liveness health group on the management port:

$ curl localhost:8088/actuator/health/liveness
{"status":"UP","components":{"diskSpace":{"status":"UP","details":{"total":1000240963584,"free":468845608960,"threshold":10485760,"exists":true}},"livenessState":{"status":"UP"},"ping":{"status":"UP"},"readinessState":{"status":"UP"}}}

The complete configuration used for this, based on your configuration in the question, was the following:

management.server.port=8088

management.endpoints.enabled-by-default=false
management.endpoint.health.enabled=true
management.endpoint.health.probes.enabled=true
management.endpoint.health.group.liveness.additional-path=server:/livez
management.endpoint.health.group.readiness.additional-path=server:/readyz
management.endpoint.health.group.readiness.show-details=always
management.endpoint.health.group.liveness.show-details=always
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement