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: https://github.com/open-telemetry/opentelemetry-go/issues/3501

Java

Yes

 

JavaScript/NodeJS

Yes

https://www.npmjs.com/package/@opentelemetry/resource-detector-container

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

https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2073

Kotlin

Yes

*Uses same sdk as java

PHP

Yes

 

Python

Yes

https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/resource/opentelemetry-resource-detector-container

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

https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/resources/container/README.md

Rust

No

No container support for resource detectors, refer to:

https://github.com/open-telemetry/opentelemetry-rust-contrib/tree/main/opentelemetry-resource-detectors/src