feat: Add /healthz and /readyz endpoint for liveness and readiness probes - #1259
Open
lollo03 wants to merge 6 commits into
Open
feat: Add /healthz and /readyz endpoint for liveness and readiness probes #1259lollo03 wants to merge 6 commits into
lollo03 wants to merge 6 commits into
Conversation
Contributor
|
with auth required endpoint you could just check if the metrics endpoint returns 401 :D |
Author
|
@nvtkaszpir You're right, though that approach isn't quite standard. I've also added a /readyz endpoint, which should be more useful here. Any feedback is welcome! |
nvtkaszpir
reviewed
Jun 13, 2026
lollo03
marked this pull request as ready for review
June 13, 2026 19:19
Move ReadyHandler creation from newRootMux to newServer, passing only the http.HandlerFunc instead of raw dependencies (configMgr, db).
Author
|
Hello @garethgeorge can you review this PR? This could be useful |
Owner
|
Hey -- apologies for the late review. Thanks for the interest in contributing! Generally, adding adding a health check and readiness probe endpoint sounds good to me, but a few thoughts on the current impl
|
The readiness probe no longer checks whether the config is loaded. This simplifies the handler and removes the config dependency.
…ness probe - ReadyHandler now queries the oplog (LIMIT 1) instead of pinging the shared kvdb, which is less critical. - Removed the Pinger interface and db parameter from newServer. - Timeout reduced from 10s to 2s. - Extracted writeReady helper and added doc comments.
Author
|
Hello, implemented your suggestions. Let me know what do you think. |
garethgeorge
force-pushed
the
main
branch
3 times, most recently
from
July 10, 2026 09:45
1a75a0a to
aeade74
Compare
Author
|
@garethgeorge would you please review the changes? |
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.
This change introduces new unauthenticated
GET /healthzandGET /readyzendpoints.These are primarily intended for use as liveness and readiness probes in environments like Kubernetes.
Changes:
internal/api/health/health.go./healthzand/readyzroutes in the main application router.api.mdto document the new endpoints.The
/healthzendpoint simply checks if the API server is alive, while/readyzthe database is accessible.Fixes #1235
This is a proof of concept; I am seeking input on a more robust implementation.