Skip to content

dura.health

Defined in dura/health.py. Heartbeat is re-exported from the top-level dura package.

Heartbeat

Heartbeat(clock: Callable[[], float] = monotonic)

Records the time of the most recent worker activity, for liveness.

Source code in dura/health.py
def __init__(self, clock: Callable[[], float] = time.monotonic) -> None:
    self._clock = clock
    self._last = clock()  # assume healthy at startup

See how to expose health checks and metrics for wiring Heartbeat up to a liveness probe, and for querying the database directly for metrics.