Fixes issue where success before passing and failures before critical were not being honoured #10256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where the health check features
success_before_passing
andfailures_before_critical
were not being honoured and status was changed immediately.This is probably also the cause of the Nomad bug listed in this issue.
hashicorp/nomad#9189
Co-authored-by: Erik Veld eveld@hashicorp.com
Previously given the following service config where the destination service http://localhost:9090 always returns a 500 or no response for the /health and /ready endpoints. Consul would immediately set the check status to critical.
This was tested by running Consul locally.
Registering the service.
And checking the logs and output from the /agent/checks endpoint
Before the first health check, the status correctly reported as
warning
, however, after the first check the status immediately moved tocritical
.After the code changes, the service correctly stays in warning until the number of consecutive failures defined in the config has been reached.
We have also tested the happy path using fake-service and the behaviour is as expected.