Restore upstream psutil or find an alternative
Description
We've moved to a fork version of psutil in https://github.com/sigp/lighthouse/pull/2699 to patch a vulnerable dependency. Once the vulnerable dep is patched upstream we should migrate back.
Tracking issue: https://github.com/rust-psutil/rust-psutil/pull/93
Alternatively we could move away from psutil entirely, the main competitor seems to be heim: https://crates.io/crates/heim
We might want to shift away from psutil. They don't seem to be maintaining it well and I've had to upgrade their deps again:
https://github.com/sigp/rust-psutil/tree/upgrade-deps
I've also had to fork a dep of this, which also seems to be fairly unmaintained. https://github.com/AgeManning/darwin-libproc/tree/requirements
https://github.com/GuillaumeGomez/sysinfo looks good as an alternative. 💡
I will investigate that whether there is any barrier to replace with it.
I've investigated with sysinfo v0.23.6 (latest version).
I found that some of the metrics observed in Lighthouse are not supported by sysinfo.
ref: common/eth2/src/lighthouse.rs#L197-L221
sysinfo doesn't support:
- sys_virt_mem_cached
- sys_virt_mem_buffers
- system_seconds_total
- cpu_time_total
- user_seconds_total
- iowait_seconds_total
- idle_seconds_total
work in progress (https://github.com/GuillaumeGomez/sysinfo/pull/683):
- disk_node_reads_total
- disk_node_writes_total
I think...
sysinfo is not enough as an alternative for now, so we can't go to replace with it.
But sysinfo is still a good candidate because:
sysinfois more actively developed than the competitorssysinfosupports a number of operating systems- the author is a contributor of the Rust ecosystem
Here is my sandbox code for the investigate. (contains Japanese comment, sorry!)