Skip to content

Commit ada9582

Browse files
[Backport release-mainnet-1.2.0-rc] fix(process-metrics): build on non-Linux platforms (#4439)
fix(process-metrics): build on non-Linux platforms (#4435) * fix(process-metrics): build on non-Linux platforms - Gate procfs dependency to cfg(target_os = "linux") so its build script no longer fails on macOS - Split into a portable ProcessMetrics (memory, cpu_count, uptime via sysinfo) and a Linux-only LinuxMetrics extension (/proc, cgroup, PSI) - Keep the only platform cfg in lib.rs; non-Linux gets an inline no-op ext * fix(process-metrics): report node_cpu_count via available_parallelism - System::new().cpus() is empty until an explicit CPU refresh, so the gauge reported 0; use std::thread::available_parallelism instead - Extract cpu_count and process_memory as pure functions with regression tests asserting non-zero CPU and memory readings (cherry picked from commit 809b0a1) Co-authored-by: Mathis <sveitser@gmail.com>
1 parent 49fa5d0 commit ada9582

4 files changed

Lines changed: 612 additions & 509 deletions

File tree

crates/process-metrics/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ description = "Process-level Prometheus metrics (RSS, virtual memory, FDs, threa
77

88
[dependencies]
99
hotshot-types = { workspace = true }
10-
procfs = { workspace = true }
1110
sysinfo = { workspace = true }
1211
tokio = { workspace = true }
1312
tracing = { workspace = true }
1413

14+
[target.'cfg(target_os = "linux")'.dependencies]
15+
procfs = { workspace = true }
16+
1517
[lints]
1618
workspace = true

0 commit comments

Comments
 (0)