Closed essobedo closed 2 years ago
@mzamani1 @joschi Hi, please tell me if this feature is clear enough and makes sense to you and if so and if you wish, I could contribute to add this feature to the project.
Hey @essobedo, thanks for the issue, and apologies it took me so long to get back to you. This should already be possible if you provide a custom health check servlet to use instead of the default one that comes with the library (specifically, you would override this method: https://github.com/dropwizard/dropwizard-health/blob/master/src/main/java/io/dropwizard/health/core/HealthCheckBundle.java#L101-L113)
Does this work for your needs, or were you thinking more enhancing the default behavior to include more statuses out of the box?
One potentially related issue would be: https://github.com/dropwizard/dropwizard-health/issues/2, and getting better out of the box support for the concept of liveness and readiness checks, as they exist in Kubernetes.
@mzamani1 thank you for your feedback and happy new year by the way! Unless I miss something, if I override the method that you mention, I will only have AtomicBoolean isHealthy
so 2 possible values true
for healthy
or false
for unhealthy
. At this point, I won't be able to know if at least one non critical dependency was unhealthy
to be able to raise the intermediate state warn
. Did I miss something?
I see, so what you’re envisioning would require more health state than the Boolean flag.
If you’d like to submit a PR, or let me know more details about what you’re thinking in terms of implementation, I’d definitely be open to that.
Up to now, we have only two possible health check statuses that are currently supported which are
healthy
andunhealthy
. The idea behind this improvement would be to add more (customizable) heath check statuses, like for example:unknown
when the application is not yet ready and can't provide its status.warn
(like in the RFC HealthCheck) when for example a non critical dependency isunhealthy
.maintenance
when the application is down for maintenance ...Within the context of this improvement, it could also be interesting to be able to configure for each health check status which http status code we would like to use as response of
HealthCheckServlet#doGet
.