Skip to content

feat: add support for detecting container.id from cgroup v2#8070

Open
ForsakenHarmony wants to merge 5 commits intoopen-telemetry:mainfrom
ForsakenHarmony:hrmny/push-poklrqmvlmnz
Open

feat: add support for detecting container.id from cgroup v2#8070
ForsakenHarmony wants to merge 5 commits intoopen-telemetry:mainfrom
ForsakenHarmony:hrmny/push-poklrqmvlmnz

Conversation

@ForsakenHarmony
Copy link

@ForsakenHarmony ForsakenHarmony commented Mar 17, 2026

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.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 17, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@ForsakenHarmony ForsakenHarmony force-pushed the hrmny/push-poklrqmvlmnz branch from 83942f1 to 3918880 Compare March 17, 2026 14:52
@ForsakenHarmony ForsakenHarmony force-pushed the hrmny/push-poklrqmvlmnz branch from 3918880 to 70a5e91 Compare March 17, 2026 14:57
@ForsakenHarmony ForsakenHarmony marked this pull request as ready for review March 17, 2026 15:50
var (
containerID containerIDProvider = getContainerIDFromCGroup
cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]+)(?:\.|\s*$)`)
cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]{64})(?:\.|\s*$)`)
Copy link
Author

@ForsakenHarmony ForsakenHarmony Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ForsakenHarmony ForsakenHarmony force-pushed the hrmny/push-poklrqmvlmnz branch from df19932 to 3b25fbe Compare March 17, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect container id on cgroup v2

1 participant