New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"OTEL_RESOURCE_ATTRIBUTES" in .env is ignored when using docker compose #4958
Comments
any chance? |
Hiya @mrasu, sorry for the delay in replying – Indeed, we started setting In the meantime, for your purposes, you could set your .env such as MY_CUSTOM_ENV_VAR="service.namespace=opentelemetry-demo" and your compose file such as services:
something:
image: ubuntu
command: tail -f /dev/null
environment:
OTEL_RESOURCE_ATTRIBUTES: ${MY_CUSTOM_ENV_VAR} |
Hm.. right, so;
Wondering if this one should either detect if it’s already set, or prepend the env-var instead of appending it; cli/cli-plugins/manager/cobra.go Lines 136 to 148 in b6c5522
I guess the overall issue to look for is;
|
Description
When using docker compose, value of "OTEL_RESOURCE_ATTRIBUTES" specifyied at
.env
file is ignored and the value becomesdocker.cli.cobra.command_path=docker%20compose
instead.It seems #4875 changes behahavior to override OTEL_RESOURCE_ATTRIBUTES.
use-case
opentelemetry-demo
uses.env
to specifyservice.namespace
for otel's namespace.But it is not working now.
You can see code here
Reproduce
.env
file specifing OTEL_RESOURCE_ATTRIBUTESdocker.cli.cobra.command_path=docker%20compose
instead ofservice.namespace=opentelemetry-demo
Expected behavior
Keep the value of "OTEL_RESOURCE_ATTRIBUTES" in
.env
.I believe adding
docker.cli.cobra.command_path
attribute is fine but the original value should be keptdocker version
Client: Docker Engine - Community Cloud integration: v1.0.24 Version: 26.0.0 API version: 1.45 Go version: go1.21.8 Git commit: 2ae903e Built: Wed Mar 20 15:17:48 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 26.0.0 API version: 1.45 (minimum version 1.24) Go version: go1.21.8 Git commit: 8b79278 Built: Wed Mar 20 15:17:48 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.28 GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: