Skip to main content

Module provider_health

Module provider_health 

Source
Expand description

§Provider Health Monitor

Tracks latency, error rates, and availability for each configured LLM provider. Exposes a health score (0.0–1.0) per provider.

The monitor maintains a rolling window of latency samples (in milliseconds) per provider. After every record call the p50/p95/p99 latencies and the rolling error rate are recomputed from the current window, and a fresh health score is derived via the formula:

score = (1.0 - error_rate) * latency_weight
where latency_weight = 1.0 / (1.0 + p95_latency_ms / 1000.0)

Structs§

ProviderHealth
A point-in-time health snapshot for a single provider.
ProviderHealthMonitor
A thread-safe, cloneable monitor that tracks per-provider health.