Expand description
HTTP health and readiness endpoints for zebrad.
Overview
- This module exposes two small HTTP/1.1 endpoints for basic liveness/readiness checks, suitable for Kubernetes probes and load balancers.
- Endpoints are opt-in, disabled by default. Enable by setting a
listen_addrin thehealthconfig section. - Plain-text responses and small responses keep the checks fast and safe.
Endpoints
GET /healthyβ returns200 OKif the process is up and the node has at leastmin_connected_peersrecently live peers (default: 1). Otherwise503 Service Unavailable.GET /readyβ returns200 OKif the node is near the chain tip, the estimated block lag is withinready_max_blocks_behind, and the latest committed block is recent. On regtest/testnet, readiness returns200unlessenforce_on_test_networksis set.
Security
- Endpoints are unauthenticated by design. Bind to internal network interfaces, and restrict exposure using network policy, firewall rules, and service configuration.
- The server does not access or return private data. It only summarises coarse node state.
Configuration and examples
- See the Zebra Book for configuration details and Kubernetes probe examples: https://zebra.zfnd.org/user/health.html
ModulesΒ§
- config π
StructsΒ§
- Chain
TipMetrics - Metrics tracking how long itβs been since
- Config
- Health server configuration.
- Health
Ctx π
ConstantsΒ§
- MAX_
RECENT_ πREQUESTS - The maximum number of requests that will be handled in a given time interval before requests are dropped.
- METHOD_
NOT_ πALLOWED_ MSG - NOT_
FOUND_ πMSG - PEER_
METRICS_ πREFRESH_ INTERVAL - RECENT_
REQUEST_ πINTERVAL
FunctionsΒ§
- handle_
request π - healthy π
- init
- Starts the health server if
listen_addris configured. - num_
live_ πpeers - peer_
metrics_ πrefresh_ task - ready π
- run_
health_ πserver - simple_
response π