pub struct WorkflowMetrics {
pub workflow_id: WorkflowId,
pub workflow_name: String,
pub state: WorkflowState,
pub start_time: Option<DateTime<Utc>>,
pub end_time: Option<DateTime<Utc>>,
pub duration: Option<Duration>,
pub tasks: HashMap<TaskId, TaskMetrics>,
pub total_tasks: usize,
pub completed_tasks: usize,
pub failed_tasks: usize,
pub running_tasks: usize,
}Expand description
Workflow execution metrics.
Fields§
§workflow_id: WorkflowIdWorkflow identifier.
workflow_name: StringWorkflow name.
state: WorkflowStateCurrent state.
start_time: Option<DateTime<Utc>>Start time.
end_time: Option<DateTime<Utc>>End time.
duration: Option<Duration>Total duration.
tasks: HashMap<TaskId, TaskMetrics>Task metrics.
total_tasks: usizeTotal task count.
completed_tasks: usizeCompleted tasks count.
failed_tasks: usizeFailed tasks count.
running_tasks: usizeRunning tasks count.
Implementations§
Source§impl WorkflowMetrics
impl WorkflowMetrics
Sourcepub fn new(
workflow_id: WorkflowId,
workflow_name: String,
total_tasks: usize,
) -> Self
pub fn new( workflow_id: WorkflowId, workflow_name: String, total_tasks: usize, ) -> Self
Create new workflow metrics.
Sourcepub fn mark_started(&mut self)
pub fn mark_started(&mut self)
Mark workflow as started.
Sourcepub fn mark_completed(&mut self)
pub fn mark_completed(&mut self)
Mark workflow as completed.
Sourcepub fn mark_failed(&mut self)
pub fn mark_failed(&mut self)
Mark workflow as failed.
Sourcepub fn update_task(&mut self, task_metrics: TaskMetrics)
pub fn update_task(&mut self, task_metrics: TaskMetrics)
Update task metrics.
Sourcepub fn progress_percentage(&self) -> f64
pub fn progress_percentage(&self) -> f64
Get progress percentage.
Sourcepub fn average_task_duration(&self) -> Option<Duration>
pub fn average_task_duration(&self) -> Option<Duration>
Get average task duration.
Sourcepub fn throughput(&self) -> f64
pub fn throughput(&self) -> f64
Get throughput (tasks per second).
Trait Implementations§
Source§impl Clone for WorkflowMetrics
impl Clone for WorkflowMetrics
Source§fn clone(&self) -> WorkflowMetrics
fn clone(&self) -> WorkflowMetrics
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 WorkflowMetrics
impl Debug for WorkflowMetrics
Source§impl<'de> Deserialize<'de> for WorkflowMetrics
impl<'de> Deserialize<'de> for WorkflowMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for WorkflowMetrics
impl RefUnwindSafe for WorkflowMetrics
impl Send for WorkflowMetrics
impl Sync for WorkflowMetrics
impl Unpin for WorkflowMetrics
impl UnsafeUnpin for WorkflowMetrics
impl UnwindSafe for WorkflowMetrics
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