xet_runtime/config/groups/system_monitor.rs
1use std::time::Duration;
2
3use crate::utils::TemplatedPathBuf;
4
5crate::config_group!({
6 /// Whether to enable system resource monitoring.
7 ///
8 /// When enabled, the system monitor will periodically sample and log system statistics
9 /// such as CPU usage, memory usage, and other resource metrics.
10 ///
11 /// The default value is false.
12 ///
13 /// Use the environment variable `HF_XET_SYSTEM_MONITOR_ENABLED` to set this value.
14 ref enabled: bool = false;
15
16 /// The interval at which to sample system statistics.
17 ///
18 /// The default value is 5 seconds.
19 ///
20 /// Use the environment variable `HF_XET_SYSTEM_MONITOR_SAMPLE_INTERVAL` to set this value.
21 ref sample_interval: Duration = Duration::from_secs(5);
22
23 /// The path to write the system monitor output to.
24 ///
25 /// If not set, the output will be written to tracing log at "INFO" level.
26 ///
27 /// Supports template variables (case-insensitive):
28 /// - `{PID}` - Replaced with the current process ID
29 /// - `{TIMESTAMP}` - Replaced with ISO 8601 timestamp in local timezone with offset
30 /// (e.g., `2024-02-05T14-30-45-0500`)
31 ///
32 /// Example: `~/logs/monitor_{PID}_{TIMESTAMP}.log`
33 ///
34 /// The default value is None.
35 ///
36 /// Use the environment variable `HF_XET_SYSTEM_MONITOR_LOG_PATH` to set this value.
37 ref log_path: Option<TemplatedPathBuf> = None;
38});