feat: add support for detecting container.id from cgroup v2#8070
Open
ForsakenHarmony wants to merge 5 commits intoopen-telemetry:mainfrom
Open
feat: add support for detecting container.id from cgroup v2#8070ForsakenHarmony wants to merge 5 commits intoopen-telemetry:mainfrom
container.id from cgroup v2#8070ForsakenHarmony wants to merge 5 commits intoopen-telemetry:mainfrom
Conversation
83942f1 to
3918880
Compare
3918880 to
70a5e91
Compare
ForsakenHarmony
commented
Mar 17, 2026
sdk/resource/container.go
Outdated
| var ( | ||
| containerID containerIDProvider = getContainerIDFromCGroup | ||
| cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]+)(?:\.|\s*$)`) | ||
| cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]{64})(?:\.|\s*$)`) |
Author
There was a problem hiding this comment.
this is probably not the correct fix for 14:name=systemd:/user.slice/user-1000.slice/user@1000.service/app.slice/podman.service being detected as a cgroup v1 id
the java implementation enforces 64 chars, but all the text fixtures were shorter
df19932 to
3b25fbe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3501
Another attempt after #3508 was closed
Similarly tries to parse cgroup v1 first and if it fails tries to parse cgroup v2.
I've tried looking at the dotnet, java and javascript implementations for relevant things to parse and handle.