Skip to main content

Module health

Module health 

Source
Expand description

The periodic line that says what the deployment currently holds, and the state behind GET /health’s progress report.

The development stack is operated by watching its log. Provisioning and record writes each announce themselves as they happen, but a developer who attaches to a quiet server sees nothing at all, and a developer scrolling back through a busy one has no marker to count against. One line every ten seconds fixes both: it is a heartbeat and a running total in the same place.

§Liveness versus progress

A process that answers HTTP is not the same claim as one whose log is advancing: a deadlocked lock, a registry stuck retrying a poisoned mutex, or a runtime with every worker parked behind a hung syscall can all leave axum answering 200 while nothing this tick would log is happening underneath it. HealthState is what lets GET /health say more than “a socket accepted” — it is the tick’s own pulse, read back rather than re-derived, so the two can never disagree about whether the tick that is the deployment’s sign of life is still ticking.

GET /health itself stays the liveness check: it answers 200 whenever this process can schedule a task at all, which is what a load balancer should gate traffic on. progress in its body is the second claim, carried in the same response rather than a separate route, so a caller that only wants liveness reads one field and a caller diagnosing a stall reads the rest of the same document.

Structs§

CertificateHealth
What GET /health reports about certificate renewal.
DiskHealth
What GET /health reports about the data volume.
DiskWatermarks
The free space, as a percentage of the data volume, below which GET /health’s disk.alert and the journal raise an alert. The [capacity] disk_*_free_percent keys set them.
HealthSnapshot
What GET /health reports beyond liveness: whether the tick that logs this deployment’s own pulse is still advancing, and how recently.
HealthState
The tick’s pulse, shared with whoever answers GET /health.
HealthTick
A running health tick, stopped by HealthTick::stop or by dropping it.
ZoneCertificateHealth
One zone’s entry in CertificateHealth::zones.

Enums§

DiskAlert
Which free-space watermark the data volume is below.

Constants§

DEFAULT_HEALTH_INTERVAL
How often the health line is written when a caller does not choose.
REVISION 🔒
The commit this binary was built from, as scripts/publish-image.sh passes it to the image build in DIDBOT_REVISION. None for a build that was not given one, such as cargo run.

Traits§

CertificateAlerts
Reads back each zone’s certificate alert level.

Functions§

log_stats 🔒
Writes one health line.