mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
update dependencies (#4639)
## Issue Addressed updates underlying dependencies and removes the ignored `RUSTSEC`'s for `cargo audit`. Also switches `procinfo` to `procfs` on `eth2` to remove the `nom` warning, `procinfo` is unmaintained see [here](https://github.com/danburkert/procinfo-rs/issues/46).
This commit is contained in:
@@ -35,14 +35,8 @@ tokio = { version = "1.14.0", features = ["full"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
psutil = { version = "3.2.2", optional = true }
|
||||
procinfo = { version = "0.4.2", optional = true }
|
||||
procfs = { version = "0.15.1", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["lighthouse"]
|
||||
lighthouse = [
|
||||
"proto_array",
|
||||
"psutil",
|
||||
"procinfo",
|
||||
"store",
|
||||
"slashing_protection",
|
||||
]
|
||||
lighthouse = ["proto_array", "psutil", "procfs", "store", "slashing_protection"]
|
||||
|
||||
@@ -95,8 +95,8 @@ pub struct ValidatorInclusionData {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
use {
|
||||
procinfo::pid, psutil::cpu::os::linux::CpuTimesExt,
|
||||
psutil::memory::os::linux::VirtualMemoryExt, psutil::process::Process,
|
||||
psutil::cpu::os::linux::CpuTimesExt, psutil::memory::os::linux::VirtualMemoryExt,
|
||||
psutil::process::Process,
|
||||
};
|
||||
|
||||
/// Reports on the health of the Lighthouse instance.
|
||||
@@ -238,7 +238,7 @@ pub struct ProcessHealth {
|
||||
/// The pid of this process.
|
||||
pub pid: u32,
|
||||
/// The number of threads used by this pid.
|
||||
pub pid_num_threads: i32,
|
||||
pub pid_num_threads: i64,
|
||||
/// The total resident memory used by this pid.
|
||||
pub pid_mem_resident_set_size: u64,
|
||||
/// The total virtual memory used by this pid.
|
||||
@@ -262,7 +262,12 @@ impl ProcessHealth {
|
||||
.memory_info()
|
||||
.map_err(|e| format!("Unable to get process memory info: {:?}", e))?;
|
||||
|
||||
let stat = pid::stat_self().map_err(|e| format!("Unable to get stat: {:?}", e))?;
|
||||
let me = procfs::process::Process::myself()
|
||||
.map_err(|e| format!("Unable to get process: {:?}", e))?;
|
||||
let stat = me
|
||||
.stat()
|
||||
.map_err(|e| format!("Unable to get stat: {:?}", e))?;
|
||||
|
||||
let process_times = process
|
||||
.cpu_times()
|
||||
.map_err(|e| format!("Unable to get process cpu times : {:?}", e))?;
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
[build-dependencies]
|
||||
zip = "0.5.8"
|
||||
zip = "0.6"
|
||||
eth2_config = { path = "../eth2_config"}
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -18,4 +18,4 @@ serde_yaml = "0.8.13"
|
||||
types = { path = "../../consensus/types"}
|
||||
ethereum_ssz = "0.5.0"
|
||||
eth2_config = { path = "../eth2_config"}
|
||||
discv5 = "0.3.1"
|
||||
discv5 = "0.3.1"
|
||||
|
||||
@@ -17,6 +17,6 @@ sloggers = { version = "2.1.1", features = ["json"] }
|
||||
slog-async = "2.7.0"
|
||||
take_mut = "0.2.2"
|
||||
parking_lot = "0.12.1"
|
||||
serde = "1.0.153"
|
||||
serde = "1.0.153"
|
||||
serde_json = "1.0.94"
|
||||
chrono = "0.4.23"
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||
|
||||
@@ -10,10 +10,14 @@ pub fn set_builder_origins(
|
||||
default_origin: (IpAddr, u16),
|
||||
) -> Result<Builder, String> {
|
||||
if let Some(allow_origin) = allow_origin {
|
||||
let origins = allow_origin
|
||||
.split(',')
|
||||
.map(|s| verify_cors_origin_str(s).map(|_| s))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let mut origins = vec![];
|
||||
for origin in allow_origin.split(',') {
|
||||
verify_cors_origin_str(origin)?;
|
||||
if origin == "*" {
|
||||
return Ok(builder.allow_any_origin());
|
||||
}
|
||||
origins.push(origin)
|
||||
}
|
||||
Ok(builder.allow_origins(origins))
|
||||
} else {
|
||||
let origin = match default_origin.0 {
|
||||
|
||||
@@ -87,7 +87,7 @@ pub fn scrape_process_health_metrics() {
|
||||
// This will silently fail if we are unable to observe the health. This is desired behaviour
|
||||
// since we don't support `Health` for all platforms.
|
||||
if let Ok(health) = ProcessHealth::observe() {
|
||||
set_gauge(&PROCESS_NUM_THREADS, health.pid_num_threads as i64);
|
||||
set_gauge(&PROCESS_NUM_THREADS, health.pid_num_threads);
|
||||
set_gauge(&PROCESS_RES_MEM, health.pid_mem_resident_set_size as i64);
|
||||
set_gauge(&PROCESS_VIRT_MEM, health.pid_mem_virtual_memory_size as i64);
|
||||
set_gauge(&PROCESS_SECONDS, health.pid_process_seconds_total as i64);
|
||||
|
||||
Reference in New Issue
Block a user