From da30d04aeffe66dfc275c5aadf86788dc54cb19e Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Mon, 8 Jun 2026 12:36:49 -0700 Subject: [PATCH] fix: remove noisy per-PID trace logs from fd usage collection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The usage-metrics monitoring loop polls /proc every 10ms (100Hz) and reads /proc/{pid}/fd for every PID. When a read_dir fails (e.g. /proc/1/fd is not readable), it logged a trace line per PID per tick — ~40 messages/invocation (~4000 per 100 invocations) when trace logging is enabled. These failures are benign (a PID's fd dir may be unreadable while it is otherwise alive), so drop the logging and fail silently with `continue`, matching the other /proc/{pid} readers (fd_max, threads_max, threads_use). Co-Authored-By: Claude Opus 4.8 --- bottlecap/src/proc/mod.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bottlecap/src/proc/mod.rs b/bottlecap/src/proc/mod.rs index 82c0faf47..30dc43e5b 100644 --- a/bottlecap/src/proc/mod.rs +++ b/bottlecap/src/proc/mod.rs @@ -12,7 +12,7 @@ use constants::{ PROC_NET_DEV_PATH, PROC_PATH, PROC_STAT_PATH, PROC_UPTIME_PATH, }; use regex::Regex; -use tracing::{debug, trace}; +use tracing::debug; #[must_use] pub fn get_pid_list() -> Vec { @@ -258,14 +258,9 @@ fn get_fd_use_data_from_path(path: &str, pids: &[i64]) -> f64 { for &pid in pids { let fd_path = format!("{path}/{pid}/fd"); let Ok(files) = fs::read_dir(&fd_path) else { - trace!( - "File descriptor use data not found in path {} with pid {}", - fd_path, pid - ); continue; }; - let count = files.count(); - fd_use += count; + fd_use += files.count(); } fd_use as f64