Skip to content

OTEL stack ignores OTEL_ variables #25839

Closed as not planned
Closed as not planned

Description

@maxkomarychev

Description

When running the opencode via SDK with OTEL enabled I am unable to control some fundamental properties of spans. More specifically service name and environment name.

The name seems to be forced to "opencode" and "deployment.environment.name" is forced to "installation channel".

I want to be able to control these via OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES

Plugins

No response

OpenCode version

latest

Steps to reproduce

  1. enable otel via config.experimental.openTelemetry = true
  2. run jaeger:
    docker run --rm --name jaeger \
      -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
      -p 16686:16686 \
      -p 4317:4317 \
      -p 4318:4318 \
      -p 14250:14250 \
      -p 14268:14268 \
      -p 14269:14269 \
      -p 9411:9411 \
      jaegertracing/all-in-one:1.76.0
  3. run opencode: OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 OTEL_SERVICE_NAME='my-name' OTEL_RESOURCE_ATTRIBUTES='deployment.environment.name=my-env' bun dev

Expected:

  1. service name "my-name"
  2. env "my-env"

Actual:

  1. service name: "opencode"
  2. env: "local"

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. Necmttn commented on Jun 22, 2026

    @Necmttn

    This should probably be tested as resource-attribute precedence.

    A useful fixture would set OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES, then assert the exported resource keeps user-supplied service.name and deployment.environment.name, with OpenCode-specific values under separate attributes like opencode.channel or opencode.version. That avoids overwriting operator routing fields that collectors rely on.

    Generated with ax - https://github.com/Necmttn/ax

  2. github-actions commented on Aug 22, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions