pub struct ExecutorMetrics {
pub tasks_spawned: AtomicU64,
pub tasks_completed: AtomicU64,
pub tasks_failed: AtomicU64,
pub tasks_cancelled: AtomicU64,
pub total_execution_time: AtomicU64,
pub active_workers: AtomicUsize,
pub idle_workers: AtomicUsize,
pub total_workers: AtomicUsize,
pub pending_tasks: AtomicUsize,
pub max_queue_depth: AtomicUsize,
pub started_at: Instant,
pub last_updated_after_ns: AtomicU64,
}Expand description
Executor performance metrics.
Every field is written by a real production path; untracked quantities (process memory, CPU utilization) deliberately have no fields here.
Fields§
§tasks_spawned: AtomicU64Tasks accepted by the executor.
tasks_completed: AtomicU64Tasks whose body ran to completion.
tasks_failed: AtomicU64Tasks whose body panicked or reported failure.
tasks_cancelled: AtomicU64Tasks whose cancel request was honored before the body ran.
total_execution_time: AtomicU64Accumulated task body execution time in nanoseconds.
active_workers: AtomicUsizeWorkers currently running a task body.
idle_workers: AtomicUsizeWorkers parked waiting for work.
total_workers: AtomicUsizeWorkers owned by the pool.
pending_tasks: AtomicUsizeTasks queued and not yet started.
max_queue_depth: AtomicUsizeHigh-water mark of the pending queue.
started_at: InstantExecutor construction instant; the metrics epoch.
last_updated_after_ns: AtomicU64Nanoseconds after started_at of the last metrics update.
Implementations§
Source§impl ExecutorMetrics
impl ExecutorMetrics
Sourcepub fn record_task_spawned(&self)
pub fn record_task_spawned(&self)
Record a new task being spawned
Sourcepub fn record_task_completed(&self, execution_time: Duration)
pub fn record_task_completed(&self, execution_time: Duration)
Record a task completion with execution time
Sourcepub fn record_task_failed(&self)
pub fn record_task_failed(&self)
Record a task failure
Sourcepub fn record_task_cancelled(&self)
pub fn record_task_cancelled(&self)
Record a task whose cancel request was honored before its body ran.
Sourcepub fn update_worker_counts(&self, active: usize, idle: usize, total: usize)
pub fn update_worker_counts(&self, active: usize, idle: usize, total: usize)
Update worker count metrics
Sourcepub fn update_queue_metrics(&self, pending: usize)
pub fn update_queue_metrics(&self, pending: usize)
Update queue metrics
Sourcepub fn throughput(&self) -> f64
pub fn throughput(&self) -> f64
Get current throughput (tasks per second)
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Get success rate as percentage
Sourcepub fn average_task_duration(&self) -> Duration
pub fn average_task_duration(&self) -> Duration
Get average task duration
Sourcepub fn worker_utilization(&self) -> f64
pub fn worker_utilization(&self) -> f64
Get worker utilization percentage
Sourcepub fn last_updated(&self) -> Instant
pub fn last_updated(&self) -> Instant
Get the last metrics update timestamp.