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#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
16#[derive(Debug, Serialize)]
17pub struct StatsResponse {
18    /// Total number of runs.
19    pub total_runs: u64,
20    /// Number of completed runs.
21    pub completed_runs: u64,
22    /// Number of failed runs.
23    pub failed_runs: u64,
24    /// Number of cancelled runs.
25    pub cancelled_runs: u64,
26    /// Number of pending or running runs.
27    pub active_runs: u64,
28    /// Success rate: completed / (completed + failed), as a percentage.
29    pub success_rate_percent: f64,
30    /// Aggregated cost across all runs in USD.
31    pub total_cost_usd: Decimal,
32    /// Aggregated duration across all runs in milliseconds.
33    pub total_duration_ms: u64,
34}