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};
6
6
use nix:: errno:: Errno ;
7
7
use procfs:: process:: Process ;
8
8
use rustc_hash:: FxHashSet ;
9
- use tracing:: error;
9
+ use tracing:: { debug , error} ;
10
10
11
11
#[ derive( thiserror:: Error , Debug ) ]
12
12
/// Errors produced by functions in this module
@@ -80,13 +80,24 @@ impl Sampler {
80
80
// Now iterate the pids and collect the unique names of the cgroups associated.
81
81
let mut cgroups = FxHashSet :: default ( ) ;
82
82
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
+ }
85
91
}
86
92
87
93
// Now iterate the cgroups and collect samples.
88
94
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
+ }
90
101
}
91
102
Ok ( ( ) )
92
103
}
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> {
43
43
}
44
44
45
45
/// 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 > {
47
47
// Read all files in the cgroup `path` and create metrics for them. If we
48
48
// lack permissions to read we skip the file. We do not use ? to allow for
49
49
// the maximal number of files to be read.
You can’t perform that action at this time.
0 commit comments