-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse containerid for a pid from cgroup as a hex chain #589
Conversation
724d829
to
a0224ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the Pull Requests!!
Now some test cases are failing because any 64-hexadecimal string is recognized as a container ID. The following container ID formats, taken also from real cgroup files, are failing:
0::/docker/8afe480d66074930353da456a1344caca810fe31c1e31f6e08c95a66887235d6/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-besteffort.slice/kubelet-kubepods-besteffort-pod44c76ce5_f953_4bd3_bc89_12621681af49.slice/cri-containerd-40c03570b6f4c30bc8d69923d37ee698f5cfcced92c7b7df1c47f6f7887378a9.scope
Also, any other entry in the Cgroup file is recognized as a docker container even if they aren't docker containers. For example:
9:memory:/docker/a2ffe0e97ac22657a2a023ad628e9df837c38a03b1ebc904d3f6d644eb1a1a81
I tink we'd need to analyse one to one the the different container formats and then use different regular expressions for each of them.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #589 +/- ##
===========================================
- Coverage 79.85% 44.81% -35.05%
===========================================
Files 70 68 -2
Lines 5917 5775 -142
===========================================
- Hits 4725 2588 -2137
- Misses 971 3034 +2063
+ Partials 221 153 -68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
a0224ec
to
862a27b
Compare
@mariomac I updated the unit tests while also allowing it to work with the previous regex (for docker) and then check for k8s cgroups before bailing out this is working with both my EKS and GKE clusters, but I would really to make it work for [@krisztianfekete] as well, before considering to merge it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about searching for the last hex block (that might also have additional characters after it, which is always (?) scope) in the string?
862a27b
to
6e95ed0
Compare
my original change was something like
but that failed a few of the unit tests originally, so we decided to keep it compatible with the previous unit tests examples |
Signed-off-by: Endre Sara <[email protected]>
6e95ed0
to
503be23
Compare
If the tests are not valid, I think we should adjust them :). Do you perhaps have an example of IDs in k8s that you can share please? |
hi, I updated the tests and included the examples both as comments in the code and in the unit tests |
Fix tests and docker parsing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks so much for working on this @esara !!!
address #588