canic_core/ops/
metrics.rs

1pub use crate::model::metrics::{
2    HttpMetricEntry, HttpMetrics, HttpMetricsSnapshot, IccMetricEntry, IccMetrics,
3    IccMetricsSnapshot, MetricsReport, SystemMetricEntry, SystemMetricKind, SystemMetrics,
4    SystemMetricsSnapshot, TimerMetricEntry, TimerMetrics, TimerMetricsSnapshot,
5};
6
7///
8/// MetricsOps
9/// Thin ops-layer facade over volatile metrics state.
10///
11
12pub struct MetricsOps;
13
14impl MetricsOps {
15    /// Export the current metrics snapshot.
16    #[must_use]
17    pub fn system_snapshot() -> SystemMetricsSnapshot {
18        SystemMetrics::snapshot()
19    }
20
21    /// Export the current HTTP metrics snapshot.
22    #[must_use]
23    pub fn http_snapshot() -> HttpMetricsSnapshot {
24        HttpMetrics::snapshot()
25    }
26
27    /// Export the current ICC metrics snapshot.
28    #[must_use]
29    pub fn icc_snapshot() -> IccMetricsSnapshot {
30        IccMetrics::snapshot()
31    }
32
33    /// Export the current timer metrics snapshot.
34    #[must_use]
35    pub fn timer_snapshot() -> TimerMetricsSnapshot {
36        TimerMetrics::snapshot()
37    }
38
39    /// Export combined metrics (system + ICC + HTTP + timers).
40    #[must_use]
41    pub fn report() -> MetricsReport {
42        MetricsReport {
43            system: Self::system_snapshot(),
44            http: Self::http_snapshot(),
45            icc: Self::icc_snapshot(),
46            timer: Self::timer_snapshot(),
47        }
48    }
49}