pub struct Telemetry {
pub timestamp: u64,
pub system: SystemInfo,
pub hardware: HardwareInfo,
pub network: NetworkInfo,
}Expand description
Full system telemetry snapshot.
Contains three sub-structures: SystemInfo, HardwareInfo,
and NetworkInfo, plus a Unix timestamp. Service detection has been
removed in favor of raw listening ports in NetworkInfo.
Fields§
§timestamp: u64Unix timestamp (seconds) when the snapshot was taken.
system: SystemInfoBasic system information (CPU, RAM, disk, uptime, load).
hardware: HardwareInfoSpecial hardware devices (TPU, GPU, JAX availability).
network: NetworkInfoNetwork state (public IP, tunnel status, listening ports).
Implementations§
Source§impl Telemetry
impl Telemetry
Sourcepub fn capture() -> Self
pub fn capture() -> Self
Captures a full system telemetry snapshot.
Results are cached for 30 seconds to avoid repeated filesystem reads on consecutive calls. Network queries (public_ip, tunnel) are included in the cached value.
Use capture_lightweight for
execution paths that don’t need accelerator detection or network
probing (e.g., the executor’s WAL audit trail — which only needs
/proc-based system health data).
Sourcepub fn capture_lightweight() -> Self
pub fn capture_lightweight() -> Self
Captures a lightweight system telemetry snapshot without shell-outs.
Unlike capture, this method skips all
accelerator detection (rocm-smi, nvidia-smi, JAX import), tunnel
probing, and public IP queries. Only SystemInfo is populated
from /proc reads and a single df shell-out.
HardwareInfo is zeroed (empty accelerators, no JAX), and
NetworkInfo returns defaults (public_ip = "unknown",
tunnel_running = false, empty listening_ports).
Use this in hot paths like the executor’s WAL audit trail where GPU/TPU/JAX counts are irrelevant and shell-outs produce unwanted stderr noise on systems without those tools installed.
Results share the same internal cache — a previous full
capture within 30 seconds will
be returned AS-IS (including hardware/network data). Callers
on hot paths should NOT rely on this returning empty hardware
if a full capture was recently cached.
Sourcepub fn clear_cache()
pub fn clear_cache()
Clears the telemetry cache.
Call this in tests or between full/lightweight captures to prevent stale cached data from leaking across capture modes.
Sourcepub fn print_report(&self)
pub fn print_report(&self)
Prints telemetry in a human-readable report to stdout.
Output includes CPU cores, RAM available, machine-parseable uptime seconds, contextualized load average (with core count), raw listening ports, and tunnel PID.