Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add detector for docker container id for cgroup v2 to be added to resource metadata #1173

Closed
svrnm opened this issue Sep 14, 2022 · 3 comments

Comments

@svrnm
Copy link
Member

svrnm commented Sep 14, 2022

Is your feature request related to a problem? Please describe

Detection of the container.id via @opentelemetry/resource-detector-docker currently works by reading from /proc/self/cgroup. That does not work when cgroupv2 is turned on. However, based on these two sources there's another place to read from:

In short, the container.id could be read from /proc/self/mountinfo as well. This also works for containerd and not only docker.

Eventually it would be good to have a standard for that, but unfortunately this is a long-standing non-moving OCI issue, until then a combination of both approaches seems to be reliable enough.

Describe the solution you'd like to see

Add code that reads the container id from /proc/self/mountinfo if reading from /proc/self/cgroup failed.

Describe alternatives you've considered

As stated in the description, eventually it would be great to have this standardized, but until then this is the best way to go.

cc: @abhee11, @osherv

@abhee11
Copy link
Contributor

abhee11 commented Sep 14, 2022

Please assign this to me - I will have a PR ready by eod today or tomorrow

@github-actions
Copy link
Contributor

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Nov 28, 2022
@svrnm
Copy link
Member Author

svrnm commented Nov 28, 2022

Closed via #1181

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants