Container Resource Attributes Collection for Telemetry Data

 

For docker environments, some of the Kfuse APM UI relies on the container_id attribute to be attaches to the Resource attributes of the telemetry data received by Kfuse. In OpenTelemetry, attaching of the container attribute is done at each language SDK. The table below shows whether discovery and adding container_id as resource attribute is supported by the language SDK (out-of-the-box, as part of the resource detectors), when running on a Docker CGroupv2 environment.


Language

Container ID Support

Notes

Language

Container ID Support

Notes

.Net

Yes

 

C++

No

 

Go

No

Pending unmerged PR: Detect container id on cgroup v2 · Issue #3501 · open-telemetry/opentelemetry-go

Java

Yes

 

JavaScript/NodeJS

Yes

npm: @opentelemetry/resource-detector-container

Pinned to version 0.2.2. Versions 0.3.* does not seem to work.

opentelemetry-resource-detector-container does not detect the container id on 0.3.4/0.3.7, but works on 0.2.2 · Issue #2073 · open-telemetry/opentelemetry-js-contrib

Kotlin

Yes

*Uses same sdk as java

PHP

Yes

 

Python

Yes

opentelemetry-python-contrib/resource/opentelemetry-resource-detector-container at main · open-telemetry/opentelemetry-python-contrib

opentelemetry-resource-detector-container is not yet published to pypi. As a workaround, use the following in requirements.txt

opentelemetry-resource-detector-container @ git+https://github.com/open-telemetry/opentelemetry-python-contrib.git@0.43b0hotfix#subdirectory=resource/opentelemetry-resource-detector-container

 

If using automatic instrumentation, add the following enviroment variable

 

OTEL_EXPERIMENTAL_RESOURCE_DETECTORS=container

 

Ruby

Yes

opentelemetry-ruby-contrib/resources/container/README.md at main · open-telemetry/opentelemetry-ruby-contrib

Rust

No

No container support for resource detectors, refer to:

opentelemetry-rust-contrib/opentelemetry-resource-detectors/src at main · open-telemetry/opentelemetry-rust-contrib