File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
lading/src/observer/linux Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use std::{collections::VecDeque, io};
66use nix:: errno:: Errno ;
77use procfs:: process:: Process ;
88use rustc_hash:: FxHashSet ;
9- use tracing:: error;
9+ use tracing:: { debug , error} ;
1010
1111#[ derive( thiserror:: Error , Debug ) ]
1212/// Errors produced by functions in this module
@@ -80,13 +80,24 @@ impl Sampler {
8080 // Now iterate the pids and collect the unique names of the cgroups associated.
8181 let mut cgroups = FxHashSet :: default ( ) ;
8282 for pid in pids {
83- let cgroup_path = v2:: get_path ( pid) . await ?;
84- cgroups. insert ( cgroup_path) ;
83+ match v2:: get_path ( pid) . await {
84+ Ok ( cgroup_path) => {
85+ cgroups. insert ( cgroup_path) ;
86+ }
87+ Err ( err) => {
88+ debug ! ( "Unable to get cgroup path for pid {pid}: {err}" ) ;
89+ }
90+ }
8591 }
8692
8793 // Now iterate the cgroups and collect samples.
8894 for cgroup_path in cgroups {
89- v2:: poll ( cgroup_path, & self . labels ) . await ?;
95+ if let Err ( err) = v2:: poll ( & cgroup_path, & self . labels ) . await {
96+ error ! (
97+ "Unable to poll cgroup metrics for {path}: {err}" ,
98+ path = cgroup_path. to_string_lossy( )
99+ ) ;
100+ }
90101 }
91102 Ok ( ( ) )
92103 }
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ pub(crate) async fn get_path(pid: i32) -> Result<PathBuf, Error> {
4343}
4444
4545/// Polls for any cgroup metrics that can be read, v2 version.
46- pub ( crate ) async fn poll ( file_path : PathBuf , labels : & [ ( String , String ) ] ) -> Result < ( ) , Error > {
46+ pub ( crate ) async fn poll ( file_path : & Path , labels : & [ ( String , String ) ] ) -> Result < ( ) , Error > {
4747 // Read all files in the cgroup `path` and create metrics for them. If we
4848 // lack permissions to read we skip the file. We do not use ? to allow for
4949 // the maximal number of files to be read.
You can’t perform that action at this time.
0 commit comments