Skip to main content

Module api_health

Module api_health 

Source
Expand description

API Health Tracking

Lock-free latency tracker fed by send_with_retry. Computes running average, jitter (standard deviation), min/max, and health status from actual request data with zero extra HTTP calls.

Structs§

ApiHealth
Global lock-free API health tracker.
HealthSnapshot
Snapshot of API health metrics at a point in time.

Enums§

HealthStatus
Health status classification based on latency metrics.

Functions§

format_duration_ms
Format a Duration as a human-readable millisecond or second string.
record_failure
Record a terminal failure (request that exhausted all retries).
record_latency
Record latency from a completed HTTP request. Called from send_with_retry on every successful completion.
snapshot
Take a snapshot of current API health metrics.
status_line
Format a one-liner status string.