I've added Actuator support for my Spring 2.0.4 application using this Baeldung article. In section 4.4 it talks about
A handy feature of health indicators is that we can aggregate them as part of a hierarchy
but it doesn't go into any discussion of how to do this aggregation. Nor have I been able to find any documentation on how to do this.
Question Do any of you know of a tutorial, example or other documentation on creating such an aggregation?
More Info
I have a service in my application which relies on several sub-components. The service itself is only considered down if all these sub-components are down. So long as one is up then the service is up. Currently using the normal HealthIndicator
mechanism if one of the sub-components is down it marks the server as down.
It seems I would want to use the CompositeHealthIndicator
but it's not clear how I create the child HealthIndicators without the system picking them up. The caveat is that each of these sub-components uses the @Scheduled
annotation, my understanding is that in order for that to work the class must use the @Component
annotation(or some such) which will cause it to be created and sucked up into the application health.
Clarification I have added actuators and the health URL comes up as this:
{"status":"UP","details":{"MyServ1":{"status":"UP","details":{"Latency":...}},"MyServ2":{"status":"UP","details":{"Latency":...}},"diskSpace":{"status":"UP","details":{"total":...,"free":...,"threshold":...}}}}
but if 'MyServ1' or 'MySrv2' are down the overall status is down, but I only want that to happen if 'diskSpace' is down OR 'MyServ1' and 'MyServ2' is down.
It would appear that CompositeHealthIndicator
would be the appropriate class for this, it is just unclear how I create the children health indicators for it (just use new
)?
Thanks in advance
http://localhost:port/actuator/health
this should work – Lashley