Skip to main content

resource_tracker/metrics/
mod.rs

1pub mod cpu;
2pub mod disk;
3pub mod disk_mount;
4pub mod disk_type;
5pub mod gpu;
6pub mod host;
7pub mod memory;
8pub mod network;
9
10pub use cpu::CpuMetrics;
11pub use disk::DiskMetrics;
12pub use disk_mount::DiskMountMetrics;
13pub use disk_type::DiskType;
14pub use gpu::GpuMetrics;
15pub use host::{CloudInfo, HostInfo};
16pub use memory::MemoryMetrics;
17pub use network::NetworkMetrics;
18
19use serde::{Deserialize, Serialize};
20
21/// A single point-in-time observation of all tracked resources.
22#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct Sample {
24    /// Unix timestamp (seconds) when this sample was taken.
25    pub timestamp_secs: u64,
26    /// Optional job label supplied via CLI or config file.
27    pub job_name: Option<String>,
28    /// Root PID of the process tree being tracked, if any.
29    /// Carried here so the CSV serializer can emit `process_pid` without
30    /// needing access to `Config`.
31    pub tracked_pid: Option<i32>,
32    pub cpu: CpuMetrics,
33    pub memory: MemoryMetrics,
34    pub network: Vec<NetworkMetrics>,
35    pub disk: Vec<DiskMetrics>,
36    /// One entry per detected GPU/NPU/TPU. Empty on CPU-only hosts.
37    pub gpu: Vec<GpuMetrics>,
38}