Skip to main content

ironflow_api/entities/
stats.rs

1//! Statistics DTOs.
2
3use rust_decimal::Decimal;
4use serde::Serialize;
5
6/// Aggregate statistics response.
7///
8/// Computed from all runs in the store.
9///
10/// # Examples
11///
12/// ```
13/// use ironflow_api::entities::StatsResponse;
14/// ```
15#[derive(Debug, Serialize)]
16pub struct StatsResponse {
17    /// Total number of runs.
18    pub total_runs: u64,
19    /// Number of completed runs.
20    pub completed_runs: u64,
21    /// Number of failed runs.
22    pub failed_runs: u64,
23    /// Number of cancelled runs.
24    pub cancelled_runs: u64,
25    /// Number of pending or running runs.
26    pub active_runs: u64,
27    /// Success rate: completed / (completed + failed), as a percentage.
28    pub success_rate_percent: f64,
29    /// Aggregated cost across all runs in USD.
30    pub total_cost_usd: Decimal,
31    /// Aggregated duration across all runs in milliseconds.
32    pub total_duration_ms: u64,
33}