Skip to content

Commit

Permalink
resolve: fix resolve container id (#982)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcelo Amaral <[email protected]>
  • Loading branch information
marceloamaral authored Oct 12, 2023
1 parent b9f42d7 commit 7dad501
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/cgroup/resolve_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ func extractPodContainerIDfromPath(path string) (string, error) {
if path == unknownPath {
return utils.SystemProcessName, fmt.Errorf("failed to find pod's container id")
}
// as the container ID is located at the end of the path, we remove the beginning of the string to prevent bugs, as seen in issue #923
split := strings.Split(path, "/")
size := len(split)
path = split[size-1 : size][0]

cgroup := config.GetCGroupVersion()
if regexFindContainerIDPath.MatchString(path) {
sub := regexFindContainerIDPath.FindAllString(path, -1)
Expand Down

0 comments on commit 7dad501

Please sign in to comment.