Skip to main content

Module metrics

Module metrics 

Source
Expand description

Dependency-free metrics registry rendering Prometheus text exposition format. Counters and histograms only (what the SLA criteria need), all lock-free on the hot path (atomics; registration takes a short mutex).

Structs§

Counter
A monotonically increasing counter.
Gauge
A signed gauge whose value may go up, down, or be set to an absolute number. Backed by AtomicI64 because Prometheus gauges are unrestricted-sign floats; we clamp to i64 here because every data-plane gauge in the workspace (open sessions, queue depth, spool bytes) is a non-negative count that fits comfortably in 63 bits, and the signed representation lets sub_saturating bottom out at 0 rather than wrap.
Histogram
Fixed-bucket latency histogram (microsecond samples).
Registry
A registry mapping metric names (+ optional fixed labels) to metrics.

Constants§

DEFAULT_LATENCY_BOUNDS_US
Default latency bucket upper bounds in microseconds: 50µs … 10s.
WIDE_LATENCY_BOUNDS_US
Wide latency bucket upper bounds in microseconds: 1ms … 300s.