Skip to content

Commit

Permalink
Fixed container_id parsing from cgroup (at least for k3s)
Browse files Browse the repository at this point in the history
  • Loading branch information
notCamelCaseName committed Jan 7, 2025
1 parent ebec92d commit 4d917f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sensors/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ impl ProcessTracker {
}
if container_id.contains("cri-containerd") {
container_id = container_id.split(':').last().unwrap().to_string();
// cgroup name sometimes look like cri-containerd-[actual container_id] so we take
// that into account
if container_id.contains("cri-containerd") {
container_id = container_id.split('-').last().unwrap().to_string();
}
}
Ok(container_id)
}
Expand Down

0 comments on commit 4d917f5

Please sign in to comment.