Add liveness, readiness, and health endpoints#1253
Open
jake-low wants to merge 1 commit into
Open
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Adds three new health checking endpoints:
/livenessalways returns 200 OK (useful to check if the process is alive and answering requests)/readinessanswers 200 OK if the database is reachable, and 503 otherwise (a reasonable proxy for whether the instance is ready to serve traffic)/healthreports on the detailed health of the service. Currently it only checks DB connectivity so the status code should always be the same as/readiness, but we can add additional non-critical checks here too (like checking if the osm.org API is online). This endpoint should return a 2xx code if MapRoulette is healthy (even if non-critical external dependencies are down) so we can use it for monitoring / alerting of outages.Once we deploy this we can switch the uptime monitor to ping
/healthinstead of/service/info(which is like/livenessin that it always succeeds if the process is alive, even if the DB is down) which will help detect outages that we currently miss. The orchestrator can switch to using/livenessand/or/readinessto see if the process itself is alive and ready to serve requests.