Dropwizard Health Checks Type Query Search Parameter Feature Does Not Exist As Documented
Dropwizard Version: 5.0.0
Bug Description:
The type query search parameter feature for health checks does not exist as documented. Only the name query parameter is implemented.
Documentation Claim: Documentation inside the Health Checks section describing health check querying feature claims that
An example of how you might query the health check, assuming you're using the default responder/responseProvider settings in configuration:
https://<hostname>:<port>/health-check?type=<type>&name=<name>replace
<type>withreadyoralive; defaults toreadyif thetypeparameter is not provided
Expected Behavior:
When querying the health check endpoint with type=ready or type=alive, the response should return only health checks of the specified type.
?type=aliveshould return only ALIVE health checks?type=readyshould return only READY health checks (or all checks if it's the default)
Actual Behavior:
Running curl "locallhost:8080/health-check?type={ready, alive}" will return an empty array as the query parameter only contains logic for name filtering in the JsonHealthResponseProvider::getViews method.
See Dropwizard Healthcheck Bug Demo repo for a demonstration of the issue described above.
> curl "localhost:8080/health-check?name=all"
[{"name":"ReadyHealthCheck","healthy":true,"type":"READY","critical":false},{"name":"AliveHealthCheck","healthy":true,"type":"ALIVE","critical":true}]%
> curl "localhost:8080/health-check?type=alive"
[]
> curl "localhost:8080/health-check?type=ready"
[]
Root Cause:
JsonHealthResponseProvider.getViews() only implements logic for the name parameter, not type
Source: dropwizard/dropwizard