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: AtomicU64§tasks_completed: AtomicU64§tasks_failed: AtomicU64§tasks_cancelled: AtomicU64Tasks whose cancel request was honored before the body ran.
total_execution_time: AtomicU64§active_workers: AtomicUsize§idle_workers: AtomicUsize§total_workers: AtomicUsize§pending_tasks: AtomicUsize§max_queue_depth: AtomicUsize§started_at: Instant§last_updated_after_ns: AtomicU64Implementations§
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.
Trait Implementations§
Source§impl Debug for ExecutorMetrics
impl Debug for ExecutorMetrics
Auto Trait Implementations§
impl !Freeze for ExecutorMetrics
impl RefUnwindSafe for ExecutorMetrics
impl Send for ExecutorMetrics
impl Sync for ExecutorMetrics
impl Unpin for ExecutorMetrics
impl UnsafeUnpin for ExecutorMetrics
impl UnwindSafe for ExecutorMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more