Agent host sets `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` to the raw generic endpoint, so Copilot CLI traces are POSTed to the wrong path (404)
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.136.2
- OS Version: Windows 11 25H2
Steps to Reproduce:
1. Set the generic OTel env vars the Copilot CLI documents (`copilot help monitoring`) at user level:
```
COPILOT_OTEL_ENABLED=true
OTEL_EXPORTER_OTLP_ENDPOINT=https://otel.example.com/base
```
where the collector sits behind an ingress that serves `/base/v1/traces` and `/base/v1/metrics`.
2. Enable `chat.agentHost.enabled` and start a Copilot session in the agent host; send one prompt.
3. Observe: the host's CLI child logs `OpenTelemetry enabled: exporter=otlp-http` and `SDK initialized successfully`, metrics arrive at the collector, **no trace spans ever arrive**, and nothing is logged client-side.
### Cause
Reading the CLI child's environment block shows the host sets:
```
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://otel.example.com/base <- raw
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://otel.example.com/base/v1/metrics <- normalized
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/json
OTEL_RESOURCE_ATTRIBUTES=...,service.namespace=vscode.agent-host
```
Per the OTLP exporter spec, a **signal-specific** endpoint is used verbatim (only the generic `OTEL_EXPORTER_OTLP_ENDPOINT` gets `/v1/` appended). So the child POSTs traces to `https://otel.example.com/base`, which any standard collector/ingress rejects with 404.
In `resources/app/out/vs/platform/agentHost/node/agentHostMain.js`:
- `getNativeSdkTelemetryConfig()` returns `traces: { endpoint: this._config.otlpEndpoint, ... }` — the raw configured value.
- The env build does `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = traces.endpoint` (raw) but `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = (external.endpoint, protocol)` — the helper that appends `/v1/metrics`.
The traces branch is missing the same normalization the metrics branch has.
### Expected
Either set `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` to `/v1/traces` (mirroring the metrics branch), or pass the generic `OTEL_EXPORTER_OTLP_ENDPOINT` through and let the SDK append the signal path.
### Impact
Every agent-host session is invisible to any OTel trace-based observability (in our case a month of sessions with no spans while terminal-launched CLI sessions on the same machine, same env vars, worked). Because the exporter is silent on 4xx, this is very hard to notice.
### Workaround
Server-side path rewrite at the ingress (`^/base/?$` → `/base/v1/traces`). Nothing client-side fixes it without breaking the terminal CLI, which correctly appends `/v1/traces` to the generic variable.
Contributor guide
Assessment
This issue has not been assessed yet.