Skip to main content

Module work_handler_pool

Module work_handler_pool 

Source
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().await returned 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 after work_rx.recv(). Permit-acquire wait is NOT counted here — see WORK_HANDLER_PERMIT_WAIT_SECONDS.

Functions§

ensure_work_handler_pool_metrics_registered
Register worker-pool saturation metrics with the given registry. Idempotent.