Skip to content

Commit

Permalink
Merge pull request #1 from rossf7/fix/k8s-cgroups-v2
Browse files Browse the repository at this point in the history
Fix/k8s cgroups v2
  • Loading branch information
josefhandl authored Jul 16, 2024
2 parents e09dfcc + 47ed17b commit e39f1ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sensors/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl ProcessTracker {
#[cfg(feature = "containers")]
let regex_cgroup_docker = Regex::new(r"^.*/docker.*$").unwrap();
#[cfg(feature = "containers")]
let regex_cgroup_kubernetes = Regex::new(r"^/kubepods.*$").unwrap();
let regex_cgroup_kubernetes = Regex::new(r"/kubepods.*$").unwrap();
#[cfg(feature = "containers")]
let regex_cgroup_containerd = Regex::new("/system.slice/containerd.service/.*$").unwrap();

Expand Down Expand Up @@ -429,6 +429,12 @@ impl ProcessTracker {
if container_id.contains("cri-containerd") {
container_id = container_id.split(':').last().unwrap().to_string();
}
if container_id.starts_with("cri-containerd-") {
container_id = container_id
.strip_prefix("cri-containerd-")
.unwrap()
.to_string();
}
Ok(container_id)
}

Expand Down

0 comments on commit e39f1ed

Please sign in to comment.