pub struct WorkerMetrics {
pub tasks_executed: u64,
pub tasks_succeeded: u64,
pub tasks_failed: u64,
pub total_execution_time_ms: u64,
pub memory_usage: u64,
pub active_tasks: u64,
}Expand description
Worker resource metrics.
Fields§
§tasks_executed: u64Total tasks executed.
tasks_succeeded: u64Total tasks succeeded.
tasks_failed: u64Total tasks failed.
total_execution_time_ms: u64Total execution time in milliseconds.
memory_usage: u64Current memory usage in bytes.
active_tasks: u64Number of active tasks.
Implementations§
Source§impl WorkerMetrics
impl WorkerMetrics
Sourcepub fn record_success(&mut self, execution_time_ms: u64)
pub fn record_success(&mut self, execution_time_ms: u64)
Record a successful task execution.
Sourcepub fn record_failure(&mut self, execution_time_ms: u64)
pub fn record_failure(&mut self, execution_time_ms: u64)
Record a failed task execution.
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Get the success rate.
Sourcepub fn avg_execution_time_ms(&self) -> f64
pub fn avg_execution_time_ms(&self) -> f64
Get the average execution time.
Trait Implementations§
Source§impl Clone for WorkerMetrics
impl Clone for WorkerMetrics
Source§fn clone(&self) -> WorkerMetrics
fn clone(&self) -> WorkerMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkerMetrics
impl Debug for WorkerMetrics
Source§impl Default for WorkerMetrics
impl Default for WorkerMetrics
Source§fn default() -> WorkerMetrics
fn default() -> WorkerMetrics
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WorkerMetrics
impl RefUnwindSafe for WorkerMetrics
impl Send for WorkerMetrics
impl Sync for WorkerMetrics
impl Unpin for WorkerMetrics
impl UnsafeUnpin for WorkerMetrics
impl UnwindSafe for WorkerMetrics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request