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 auto-detection of container information to resource if cgroupv2 is used #693

Closed
svrnm opened this issue Oct 13, 2022 · 2 comments
Closed
Labels
comp:resources.container Things related to OpenTelemetry.Resources.Container

Comments

@svrnm
Copy link
Member

svrnm commented Oct 13, 2022

Issue with OpenTelemetry.Extensions.Docker

Is this a feature request or a bug?

Feature Request

What is the expected behavior?

When using a docker container with cgroupv2 turned on I would like to see a container.id being automatically detected.

What is the actual behavior?

When I use a docker container with cgroupv2 turned on I don't get the container.id detected automatically

Additional Context

This is a known "issue", it has been fixed with the JavaScript implementation already (ContainerDetector.ts):

Detection of the container.id in ContainerResource.java 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.

Related

We wanted to use the container.id as an example for resource detection at the OTel docs: open-telemetry/opentelemetry.io#1835
Same ticket for Java Instrumentation: open-telemetry/opentelemetry-java-instrumentation#6694

cc @cartermp, @swetharavichandrancisco

Containerd

The Node.JS implementation also works with other container runtime implementations, namely contaienrd, probably others as well.

@svrnm svrnm added the comp:resources.container Things related to OpenTelemetry.Resources.Container label Oct 13, 2022
@iskiselev
Copy link
Contributor

Fixed with #839

iskiselev added a commit to iskiselev/opentelemetry-dotnet-contrib that referenced this issue Jan 12, 2023
* Changes
Update CHANGELOG for 1.1.0-beta.1 release, that will include CGroup V2 support (open-telemetry#839, open-telemetry#693). It still have `-beta.1` suffix to make it prerelease until decision on package name will be done (open-telemetry#881, open-telemetry#869)
@Kielek
Copy link
Contributor

Kielek commented Jan 12, 2023

Closing: #693 (comment)

@Kielek Kielek closed this as completed Jan 12, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
comp:resources.container Things related to OpenTelemetry.Resources.Container
Projects
None yet
Development

No branches or pull requests

3 participants