threadman 0.1.0
Header-only C++23 managed threads, dynamic pools, futures, and executors
Loading...
Searching...
No Matches
Functions
threadman::metrics Namespace Reference

Functions

std::shared_ptr< prom::Scope > & scope ()
 The shared threadman scope; applies the tm_ prefix to every metric.
 
prom::Counter & pool_tasks_submitted ()
 Tasks submitted to a thread pool (all submit variants).
 
prom::Counter & pool_tasks_completed ()
 Tasks that ran to completion on a pool worker.
 
prom::Counter & pool_tasks_failed ()
 Tasks whose body threw an exception.
 
prom::Counter & pool_tasks_cancelled ()
 Tasks cancelled before running (drained by shutdown_now).
 
prom::Counter & pool_queue_rejected ()
 Submissions rejected because a bounded queue was full.
 
prom::Counter & pool_submit_rejected ()
 Submissions rejected because the pool was shutting down or terminated.
 
prom::Counter & pool_scale_ups ()
 Non-core workers spawned by a scale-up decision.
 
prom::Counter & pool_scale_downs ()
 Non-core workers retired after idling out.
 
prom::Gauge & pool_queue_depth ()
 Tasks currently waiting in a pool's queue (set from the summary tick).
 
prom::Gauge & pool_workers ()
 Live workers in a pool (set from the summary tick).
 
prom::Gauge & pool_workers_active ()
 Workers currently executing a task (set from the summary tick).
 
prom::Gauge & pool_workers_idle ()
 Workers currently idle on the queue (set from the summary tick).
 
prom::Histogram & pool_task_execution_seconds ()
 Wall-clock seconds a task body spent executing.
 
prom::Histogram & pool_task_queue_wait_seconds ()
 Seconds a task waited in the queue before a worker picked it up.
 
prom::Counter & threads_created ()
 ManagedThread bodies that entered (started running).
 
prom::Counter & threads_completed ()
 ManagedThread bodies that returned normally.
 
prom::Counter & threads_failed ()
 ManagedThread bodies that exited by throwing.
 
prom::Gauge & threads_live ()
 ManagedThread bodies currently running (inc on enter, dec on exit).
 
prom::Counter & manager_threads_registered ()
 Thread control blocks registered with the manager.
 
prom::Counter & manager_summaries_published ()
 Periodic ManagerSummary payloads published to listeners.
 
prom::Gauge & manager_pools_live ()
 Pools currently registered with the manager (set from the summary tick).
 
prom::Counter & tasks_stuck_detected ()
 Distinct tasks newly detected as stuck (running past the threshold).
 
prom::Gauge & tasks_stuck_current ()
 Tasks currently flagged as stuck (set from the housekeeper tick).
 
prom::Counter & futures_created ()
 Promise/Future pairs created.
 
prom::Counter & futures_satisfied_value ()
 Futures satisfied with a value.
 
prom::Counter & futures_satisfied_exception ()
 Futures satisfied with an exception.
 
prom::Counter & future_continuations_registered ()
 .then/.on_error continuations registered against a future.
 
prom::Counter & future_continuations_dispatched ()
 Continuations dispatched through an executor.
 
void warm_up ()
 Eagerly construct the scope and every metric handle (and, transitively, prom's process-wide adapter cell / NullAdapter).
 

Function Documentation

◆ future_continuations_dispatched()

prom::Counter & threadman::metrics::future_continuations_dispatched ( )
inline

Continuations dispatched through an executor.

◆ future_continuations_registered()

prom::Counter & threadman::metrics::future_continuations_registered ( )
inline

.then/.on_error continuations registered against a future.

◆ futures_created()

prom::Counter & threadman::metrics::futures_created ( )
inline

Promise/Future pairs created.

◆ futures_satisfied_exception()

prom::Counter & threadman::metrics::futures_satisfied_exception ( )
inline

Futures satisfied with an exception.

◆ futures_satisfied_value()

prom::Counter & threadman::metrics::futures_satisfied_value ( )
inline

Futures satisfied with a value.

◆ manager_pools_live()

prom::Gauge & threadman::metrics::manager_pools_live ( )
inline

Pools currently registered with the manager (set from the summary tick).

◆ manager_summaries_published()

prom::Counter & threadman::metrics::manager_summaries_published ( )
inline

Periodic ManagerSummary payloads published to listeners.

◆ manager_threads_registered()

prom::Counter & threadman::metrics::manager_threads_registered ( )
inline

Thread control blocks registered with the manager.

◆ pool_queue_depth()

prom::Gauge & threadman::metrics::pool_queue_depth ( )
inline

Tasks currently waiting in a pool's queue (set from the summary tick).

◆ pool_queue_rejected()

prom::Counter & threadman::metrics::pool_queue_rejected ( )
inline

Submissions rejected because a bounded queue was full.

◆ pool_scale_downs()

prom::Counter & threadman::metrics::pool_scale_downs ( )
inline

Non-core workers retired after idling out.

◆ pool_scale_ups()

prom::Counter & threadman::metrics::pool_scale_ups ( )
inline

Non-core workers spawned by a scale-up decision.

◆ pool_submit_rejected()

prom::Counter & threadman::metrics::pool_submit_rejected ( )
inline

Submissions rejected because the pool was shutting down or terminated.

◆ pool_task_execution_seconds()

prom::Histogram & threadman::metrics::pool_task_execution_seconds ( )
inline

Wall-clock seconds a task body spent executing.

◆ pool_task_queue_wait_seconds()

prom::Histogram & threadman::metrics::pool_task_queue_wait_seconds ( )
inline

Seconds a task waited in the queue before a worker picked it up.

◆ pool_tasks_cancelled()

prom::Counter & threadman::metrics::pool_tasks_cancelled ( )
inline

Tasks cancelled before running (drained by shutdown_now).

◆ pool_tasks_completed()

prom::Counter & threadman::metrics::pool_tasks_completed ( )
inline

Tasks that ran to completion on a pool worker.

◆ pool_tasks_failed()

prom::Counter & threadman::metrics::pool_tasks_failed ( )
inline

Tasks whose body threw an exception.

◆ pool_tasks_submitted()

prom::Counter & threadman::metrics::pool_tasks_submitted ( )
inline

Tasks submitted to a thread pool (all submit variants).

◆ pool_workers()

prom::Gauge & threadman::metrics::pool_workers ( )
inline

Live workers in a pool (set from the summary tick).

◆ pool_workers_active()

prom::Gauge & threadman::metrics::pool_workers_active ( )
inline

Workers currently executing a task (set from the summary tick).

◆ pool_workers_idle()

prom::Gauge & threadman::metrics::pool_workers_idle ( )
inline

Workers currently idle on the queue (set from the summary tick).

◆ scope()

std::shared_ptr< prom::Scope > & threadman::metrics::scope ( )
inline

The shared threadman scope; applies the tm_ prefix to every metric.

◆ tasks_stuck_current()

prom::Gauge & threadman::metrics::tasks_stuck_current ( )
inline

Tasks currently flagged as stuck (set from the housekeeper tick).

◆ tasks_stuck_detected()

prom::Counter & threadman::metrics::tasks_stuck_detected ( )
inline

Distinct tasks newly detected as stuck (running past the threshold).

◆ threads_completed()

prom::Counter & threadman::metrics::threads_completed ( )
inline

ManagedThread bodies that returned normally.

◆ threads_created()

prom::Counter & threadman::metrics::threads_created ( )
inline

ManagedThread bodies that entered (started running).

◆ threads_failed()

prom::Counter & threadman::metrics::threads_failed ( )
inline

ManagedThread bodies that exited by throwing.

◆ threads_live()

prom::Gauge & threadman::metrics::threads_live ( )
inline

ManagedThread bodies currently running (inc on enter, dec on exit).

◆ warm_up()

void threadman::metrics::warm_up ( )
inline

Eagerly construct the scope and every metric handle (and, transitively, prom's process-wide adapter cell / NullAdapter).

Idempotent and cheap after the first call.

Why this matters: the process-wide ThreadManager singleton runs a housekeeper thread that publishes metrics on every tick until process exit. Function-local statics are destroyed in reverse order of construction, so touching these accessors before the singleton is constructed guarantees they (and the prom infrastructure) outlive it — the singleton's destructor stops and joins the housekeeper while every metric it might touch is still alive. ThreadManager::instance() calls this before creating the singleton.