Commit ada9582
[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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
0 commit comments