Skip to main content

queue_telemetry

Function queue_telemetry 

Source
pub fn queue_telemetry() -> QueueTelemetry
Expand description

Snapshot the current queue telemetry counters.

This is a lock-free, best-effort snapshot: the counters are loaded independently, so under concurrent enqueue/process the derived in_flight may transiently disagree with any single instantaneous state. The skew is bounded and one-directional — enqueued is loaded first (the oldest value) and processed last (the newest), so in_flight can only underestimate the true backlog (floored at 0 by the saturating subtraction), never overestimate it. That is the safe bias for the consumers (load-governor pressure classification, backpressure), which read it per-frame and recover on the next interval; do not treat it as an exact, linearizable count.

dropped is deliberately NOT subtracted from in_flight: drop paths reject a task before it is ever counted as enqueued, so subtracting it would double-penalize and permanently understate the backlog after any overload episode.