Repository navigation
fix(metrics): serve the process collector's memory and CPU metrics - #750
Conversation
The beacon dashboard's memory panel reads process_resident_memory_bytes, which no ethlambda build exported: the prometheus crate only registers its process collector with the default registry when its `process` feature is on. Only a build that pulls ethrex's metrics in (the embedded follower) had it, through feature unification, so every other node's memory panel was blank. Turn the feature on for the workspace. On Linux the default registry, which the metrics endpoint gathers from, now carries process_resident_memory_bytes and the other process_* series; other platforms are unchanged.
🤖 Kimi Code ReviewI'll review this PR which enables Prometheus process metrics on Linux. Let me analyze each file. Cargo.lockNo issues. The lockfile changes are mechanically correct consequences of enabling the Cargo.tomlLine 98: The feature gating is correct—
|
| Aspect | Assessment |
|---|---|
| Correctness | Correct |
| Security | No concerns — /proc/self is a kernel-generated pseudofilesystem, not attacker-controlled |
| Performance | Minimal — /proc reads at scrape time are cheap; this is standard Prometheus practice |
| Rust idioms | Appropriate use of cfg gating |
| Memory safety | N/A — no unsafe code |
Verdict: Approve. The PR is correct, well-documented, and appropriately tested. The only minor note is that the duplicate rustix versions in Cargo.lock will slightly increase compile times and binary size, but this is a transitive dependency issue outside this PR's scope.
Automated review by Kimi (Moonshot AI) · kimi-k2.6 · custom prompt
🤖 Claude Code ReviewReview of PR 750: serve the process collector's memory and CPU metrics The change looks correct and is well scoped. I found no blocking issues.
Approve. Automated review by Claude (Anthropic) · sonnet · custom prompt |
🤖 Codex Code ReviewLooks good overall. This PR is narrowly scoped, and I do not see consensus-layer, SSZ, fork-choice, attestation, or XMSS risks in the actual code changed.
Minor note:
Validation note:
Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
) The beacon dashboard's memory panel reads process_resident_memory_bytes, which no ethlambda build exported: the prometheus crate only registers its process collector with the default registry when its `process` feature is on. Only a build that pulls ethrex's metrics in (the embedded follower) had it, through feature unification, so every other node's memory panel was blank. Turn the feature on for the workspace. On Linux the default registry, which the metrics endpoint gathers from, now carries process_resident_memory_bytes and the other process_* series; other platforms are unchanged. Cherry-picked from fix/metrics-process-collector at a9d8119.
Cargo.lock conflicted in the dependency lists of rustix 1.1.4 and tempfile: this branch moved both to windows-sys 0.52.0, while main (#750, prometheus's process feature) added rustix 0.38.44 and linux-raw-sys 0.4.15, which forces the version-qualified names. The resolution keeps both: windows-sys 0.52.0 with the qualified names. `cargo metadata --locked` accepts the result unchanged.
The beacon dashboard's "Resident memory" panel reads
process_resident_memory_bytes{job="beacon"}, which no ethlambda build exported. Theprometheuscrate only registers its process collector with the default registry when itsprocessfeature is on. Only the embedded-ethrex follower had it, because ethrex turns the feature on and features unify. Every other node's memory panel was blank, eth-2, eth-3 and eth-4 included.What changed
Cargo.toml:prometheus = { version = "0.14", features = ["process"] }. On Linux the default registry, which/metricsgathers from (gather_default_metrics), now carriesprocess_resident_memory_bytes,process_virtual_memory_bytes,process_cpu_seconds_total,process_open_fds,process_max_fds,process_threadsandprocess_start_time_seconds, read from/proc/selfat each scrape. Other platforms are unchanged.Cargo.lock: addsprocfs/procfs-core0.17.0, plus the olderrustix0.38 andlinux-raw-sys0.4 they depend on.make cooldown-checkpasses.docs/metrics.md: the process metrics, under Node Info Metrics.process_resident_memory_bytes, so dropping the feature fails CI instead of blanking the dashboard.Tests
make lintclean,make cooldown-checkpasses (macOS; the new test is compiled out there).