Skip to content

Health

rn_forge.fastapi.health

Build liveness and readiness routes.

health_router(*, checks, required=(), prefix='', timeout=None, liveness_path=LIVENESS_PATH, readiness_path=READINESS_PATH, legacy_liveness_path=LEGACY_LIVENESS_PATH)

Return a router serving the liveness and readiness paths.

Parameters:

Name Type Description Default
checks Mapping[str, Check]

Name → check, sync or async, returning a :class:rn_forge.web.CheckResult or a bool. A check that raises is reported as fail; it never fails the endpoint.

required
required Collection[str]

The names whose failure makes the service unavailable (503).

()
prefix str

Mounted in front of every path.

''
timeout float | None

Seconds each check may run before it is reported as fail, so a hung dependency cannot hang the readiness path. None waits indefinitely.

None
liveness_path str

The liveness path.

LIVENESS_PATH
readiness_path str

The readiness path.

READINESS_PATH
legacy_liveness_path str | None

An alias of liveness_path, marked deprecated in the OpenAPI document. None serves no alias.

LEGACY_LIVENESS_PATH