Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override healthcheck HTTP status #1821

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ protected void doGet(HttpServletRequest req,
if (results.isEmpty()) {
resp.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
maffe marked this conversation as resolved.
Show resolved Hide resolved
} else {
if (isAllHealthy(results)) {
final boolean alwaysOk = Boolean.parseBoolean(req.getParameter("alwaysOk"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rename the parameter to overrideStatusCode?

The name alwaysOk implies that the health check result would be always healthy. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I planned to name it similar to your proposal, but then I thought this would suggest the parameter value should be the desired status code (overrideStatusCode=200) instead of a boolean. I included OK because this is the official name for HTTP status 200. Also, I think OK differs from healthy enough to not suggest it would affect those entries.

Maybe httpStatusOk=true?

if (alwaysOk || isAllHealthy(results)) {
resp.setStatus(HttpServletResponse.SC_OK);
} else {
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
Expand Down