Skip to main content

Module metrics

Module metrics 

Source
Expand description

Lightweight runtime metrics.

Metrics is an Arc-clonable bag of atomic counters intended to be embedded in long-lived components (ConnectionAcceptor on the server, Client on the client side). Increments are Ordering::Relaxed — cheap on the hot path, safe to read concurrently. Use snapshot() for an atomic-ish point-in-time view to feed into Prometheus / logging / health endpoints.

The default is a zeroed instance; consumers that don’t care can ignore it and pay only the cost of a few relaxed atomic increments (negligible vs the QUIC and crypto cost of any real operation).

Structs§

Counters
Counters tracked across the lifetime of a server or client.
Metrics
Cheap-to-clone handle to a shared set of counters.
MetricsSnapshot
Plain, copyable snapshot of metric values at a single point in time.