Skip to main content

Module metrics

Module metrics 

Source
Expand description

OpenMetrics/Prometheus metrics and a minimal /metrics HTTP server.

Metrics live in an iroh_metrics::Registry so we can surface both our decdn_* counters and iroh’s own transport metrics through a single endpoint. Output is OpenMetrics text, which Prometheus scrapers accept.

Structs§

ConnectionGuard
RAII guard for the active_connections gauge.
DecdnMetrics
deCDN-specific counters and gauges surfaced at /metrics.
Metrics
Aggregated deCDN node metrics.

Enums§

ProbeHoldUnavailableReason
Why a probe for a present blob got no eviction hold, as the reason label on decdn_probe_hold_unavailable_total.
ServeEconomicsRegime
Which buy-ceiling regime an ADR 041 serve-economics refusal was decided under, dispatched to the matching sibling counter by Metrics::serve_economics_refused.

Constants§

INBOUND_FAILURE_REASONS
Every counter that names why an inbound cdn/client/v1 stream failed. Each failed inbound stream counts on exactly one of them, so decdn_streams_failed_total{direction="inbound"} minus their sum is zero. The serve handler counts every end in one place, so a scrape never sees a failure before its reason. The “Unattributed stream failures” panels of the reference dashboards in decdn/devops subtract this list by hand, so a new reason here needs the same edit there.

Functions§

bind
Bind the /metrics HTTP listener synchronously so startup can fail fast if the port is unavailable. The returned listener is consumed by serve.
serve
Serve /metrics over HTTP on the pre-bound listener until shutdown fires. The shutdown receiver is consumed; send () to stop the accept loop.