While testing my application on Kubernetes, I configured the /_healthz/ endpoint as the startupProbe.
The probe kept failing, but nothing was logged to indicate which health check was responsible.
The only way I could identify the issue was by manually running the checks from the shell:
>>> from health_check.checks import *; import asyncio; res = asyncio.run(DNS().get_result()); print(res)
HealthCheckResult(..., error=ServiceUnavailable("DNS resolution failed..."), ...)
get_result() already captures the exception and returns it in a HealthCheckResult, but the error is never logged
Would it be possible to log failed health checks (e.g. at warning or error level)?
This would make debugging much easier and allow us to immediately see which checks fails.
Maybe, add a logger here:
|
has_errors = any(result.error for result in self.results) |
something similar to
|
async def _run_checks_directly(self, path): |
Thanks
Daniel
While testing my application on Kubernetes, I configured the
/_healthz/endpoint as thestartupProbe.The probe kept failing, but nothing was logged to indicate which health check was responsible.
The only way I could identify the issue was by manually running the checks from the shell:
get_result()already captures the exception and returns it in aHealthCheckResult, but the error is never loggedWould it be possible to log failed health checks (e.g. at warning or error level)?
This would make debugging much easier and allow us to immediately see which checks fails.
Maybe, add a logger here:
django-health-check/health_check/views.py
Line 120 in 2d9b82d
django-health-check/health_check/management/commands/health_check.py
Line 145 in 2d9b82d
Thanks
Daniel