diff --git a/src/sources/host_metrics/cgroups.rs b/src/sources/host_metrics/cgroups.rs index 2f88a4f164222..5f999003f074f 100644 --- a/src/sources/host_metrics/cgroups.rs +++ b/src/sources/host_metrics/cgroups.rs @@ -116,7 +116,7 @@ impl<'a> CGroupRecurser<'a> { if self.load_cpu { self.load_cpu(&cgroup, &tags).await; } - if self.load_memory && !cgroup.is_root() { + if self.load_memory { self.load_memory(&cgroup, &tags).await; } @@ -271,10 +271,6 @@ struct CGroup { } impl CGroup { - fn is_root(&self) -> bool { - self.name == Path::new("/") - } - fn tags(&self) -> MetricTags { metric_tags! { "cgroup" => self.name.to_string_lossy(), @@ -599,11 +595,11 @@ mod tests { ); assert_eq!( count_name(&metrics, "cgroup_memory_anon_bytes"), - SUBDIRS.len() - 1 + SUBDIRS.len() ); assert_eq!( count_name(&metrics, "cgroup_memory_file_bytes"), - SUBDIRS.len() - 1 + SUBDIRS.len() ); }