Expand description
Worker-pool saturation metrics for the shared TCP server (backend side).
These metrics expose queue buildup between work_tx.send() and dispatcher
pickup, and permit starvation in the bounded worker pool.
Statics§
- WORK_
HANDLER_ ENQUEUE_ REJECTED_ TOTAL - Total times
work_tx.send().awaitreturned an error, which for tokio’s bounded mpsc only happens when the receiver (dispatcher task) is gone — the channel applies backpressure on “full” rather than returning an error. - WORK_
HANDLER_ PERMIT_ WAIT_ SECONDS - Time spent waiting to acquire a worker-pool permit. Normal operation is sub-millisecond; saturation pushes p99 into seconds.
- WORK_
HANDLER_ POOL_ ACTIVE_ TASKS - Current number of active worker-pool tasks (permits in use).
- WORK_
HANDLER_ POOL_ CAPACITY - Configured worker-pool capacity (total permits). Static; set once at server init.
- WORK_
HANDLER_ QUEUE_ CAPACITY - Configured capacity of the bounded work queue. Static; set once at server init.
- WORK_
HANDLER_ QUEUE_ DEPTH - Current items sitting in the bounded mpsc work queue awaiting dispatcher
pickup. Incremented on successful
work_tx.send()and decremented immediately afterwork_rx.recv(). Permit-acquire wait is NOT counted here — seeWORK_HANDLER_PERMIT_WAIT_SECONDS.
Functions§
- ensure_
work_ handler_ pool_ metrics_ registered - Register worker-pool saturation metrics with the given registry. Idempotent.