Skip to main content

Module health

Module health 

Source
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"}.
ReadinessChecks
Named readiness checks and their bounds.
ReadyReport
The readiness answer.

Enums§

CheckStatus
The outcome of one check.

Functions§

liveness
A GET path liveness route for App::routes.
liveness_router
The liveness handler, documented under the health tag with the operation ID liveness; mount it with liveness or App::route(path, liveness_router()).
readiness
A GET path readiness route running checks.
readiness_router
The readiness handler for checks, documented under the health tag with the operation ID readiness.
sql_check
A check that the database answers SELECT 1 through db’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§

CheckError
What one check failing means for the log; never sent to clients.
CheckFuture
What a check returns.