Copilot OTel file exporter writes spans as empty objects and drops captureContent attributes

Open
#319,993 4 comments 0 reactions 2 assignees View on GitHub

@rwoll is already working on this.

Since Sep 17, 2026.

Assessment

This issue has not been assessed yet.

Description

  • Copilot Chat Extension Version: 0.51.0
  • VS Code Version: 1.123.0
  • OS Version: macOS
  • Feature (e.g. agent/edit/ask mode): Agent mode / Copilot Chat OpenTelemetry file exporter
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): GPT-5.2-Codex
  • Logs:

The Copilot Chat runtime log confirms that OpenTelemetry is enabled with file export and content capture:

[OTel] Instrumentation enabled — exporter=file ... captureContent=true

My VS Code settings are:

"github.copilot.chat.otel.enabled": true,
"github.copilot.chat.otel.exporterType": "file",
"github.copilot.chat.otel.outfile": "/tmp/copilot-otel.jsonl",
"github.copilot.chat.otel.captureContent": true

The generated /tmp/copilot-otel.jsonl contains log and metric records such as:

gen_ai.usage.input_tokens
gen_ai.usage.output_tokens
gen_ai.request.model
gen_ai.response.model
copilot_chat.tool.call
gen_ai.tool.name
traceId
spanId

However, the content-bearing span attributes do not appear:

grep -n "gen_ai.input.messages\|gen_ai.output.messages\|gen_ai.tool.call.arguments\|gen_ai.tool.call.result" /tmp/copilot-otel.jsonl

This returns no matches.

The file also contains empty JSON objects:

{}

Based on local inspection, these empty objects appear to correspond to exported spans. Logs and metrics serialize correctly, but spans appear to be written as empty objects.

Steps to Reproduce:

  1. Enable Copilot Chat OpenTelemetry file export with content capture:
"github.copilot.chat.otel.enabled": true,
"github.copilot.chat.otel.exporterType": "file",
"github.copilot.chat.otel.outfile": "/tmp/copilot-otel.jsonl",
"github.copilot.chat.otel.captureContent": true
  1. Reload VS Code.

  2. Run a Copilot Chat / Agent mode interaction that performs at least one tool call or file edit.

  3. Inspect /tmp/copilot-otel.jsonl.

  4. Observe that logs and metrics are written correctly, but span records appear as {} and content-bearing span attributes are missing.

Expected Behavior:

With github.copilot.chat.otel.captureContent set to true, I expected the file exporter to preserve span attributes such as:

gen_ai.input.messages
gen_ai.output.messages
gen_ai.tool.call.arguments
gen_ai.tool.call.result

These fields are important because they should contain prompt messages, response messages, tool-call arguments, and tool-call results.

Actual Behavior:

The JSONL file contains metadata logs and metrics, including model names, token counts, tool names, durations, trace IDs, and span IDs.

However, the content-bearing fields are missing, and spans appear to be serialized as {}.

Additional Investigation:

I inspected the bundled Copilot Chat implementation locally. The implementation appears to include the requested content attribute names and conditionally attach them when content capture is enabled.

However, the file exporter appears to serialize OpenTelemetry span objects directly. Since OpenTelemetry ReadableSpan properties are not directly JSON-enumerable, this appears to produce {} for span records.

The SQLite span exporter appears to use a proper span-conversion path, so this may be specific to the file exporter.

Question:

Is this expected behavior for the file exporter, or should it serialize spans in the same way as the SQLite/OTLP exporters?

If this is a bug, I would be willing to help test a fix or submit a PR if maintainers confirm the expected serialization path.

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.