Expand description
Opt-in health routes: process liveness
(App::routes([liveness("/livez")])) and readiness with bounded
application checks (readiness).
The route answers 200 with {"status":"alive"} and
Cache-Control: no-store whenever the server can answer at all, in
every lifecycle phase, and reads nothing else: no database, no
readiness, no version or host details. It is registered only where the
application asks, so it never collides with an application route (a
path used twice is rejected when the app is built, like any duplicate).
Liveness says the process still serves requests; it is not readiness. The server binds only after startup completes and stops accepting new connections when shutdown begins, so a probe gets no connection before startup and after shutdown starts (requests already on a connection are still answered while it drains). Size the probe’s failure threshold to cover the shutdown timeout so a draining process is not restarted.
Structs§
- Alive
- The liveness answer: always
{"status":"alive"}. - Readiness
Checks - Named readiness checks and their bounds.
- Ready
Report - The readiness answer.
Enums§
- Check
Status - The outcome of one check.
Functions§
- liveness
- A
GET pathliveness route forApp::routes. - liveness_
router - The liveness handler, documented under the
healthtag with the operation IDliveness; mount it withlivenessorApp::route(path, liveness_router()). - readiness
- A
GET pathreadiness route runningchecks. - readiness_
router - The readiness handler for
checks, documented under thehealthtag with the operation IDreadiness. - sql_
check - A check that the database answers
SELECT 1throughdb’s existing pool. SQL backends only: on MongoDB or Redis it fails, so write a check with the client the app already has.
Type Aliases§
- Check
Error - What one check failing means for the log; never sent to clients.
- Check
Future - What a check returns.