Skip to content

fix: opencode run does not emit OTLP traces even with experimental.openTelemetry enabled #13438

@bestend

Description

@bestend

Summary

opencode run does not produce any trace spans in a local OTEL collector, even when experimental.openTelemetry is enabled and OTEL exporter env vars are set.

In the same environment, manual OTLP trace ingestion works, so collector/backend path is healthy.

Environment

  • OpenCode version: 1.1.65
  • OS: macOS (darwin)
  • Local stack: OpenTelemetry Collector (otel/opentelemetry-collector-contrib:0.123.0) + Jaeger (jaegertracing/jaeger:2.4.0)

Reproduction

  1. Enable OpenTelemetry feature in config:
    {
      "$schema": "https://opencode.ai/config.json",
      "experimental": {
        "openTelemetry": true
      }
    }
  2. Start local collector + jaeger (OTLP HTTP on :4318, gRPC on :4317).
  3. Send a manual OTLP trace to collector (POST /v1/traces) as control.
  4. Run opencode with OTEL env:
    • OTEL_TRACES_EXPORTER=otlp
    • OTEL_METRICS_EXPORTER=none
    • OTEL_LOGS_EXPORTER=none
    • OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
    • OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
    • OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
    • OTEL_SERVICE_NAME=opencode-local-smoke
  5. Compare collector trace count and logs before/after.

Observed Result

  • Baseline trace count: 1
  • After manual OTLP control trace: 2 (as expected)
  • After opencode run: still 2 (no new trace)
  • Collector debug logs only show manual services (manual-curl-test, manual-control), no opencode service.
  • Jaeger /api/services also shows only manual test services.

Expected Result

With experimental.openTelemetry=true + OTEL exporter env vars, opencode run should emit spans to OTLP collector.

Additional Notes

Potentially related issues:

This report is specifically about runtime emission behavior: collector path is verified healthy, but opencode spans are not emitted.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions