feat(otel): allow Copilot CLI agents to enrich native spans with delivery context #4967
Copy link
Copy link
Open
Open
Copy link
Labels
area:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agentsPlugin system, marketplace, hooks, skills, extensions, and custom agents
Description
Activity
I like the allow-listed approach. I would make this a small context broker rather than exposing the span object directly to the model.
Something like:
telemetry.set_context({key: value, ...})where the runtime validates allowed keys, type/length/cardinality, records provenance, and snapshots the context onto subsequent native spans.
That gives useful properties:
- model code cannot mutate arbitrary exporter/runtime state;
- attributes remain bounded;
- org policy can filter keys centrally;
- every value can carry
source=runtime|agent|integration.
For evaluating agent ROI, the high-value join is exactly what the issue describes: session/tool/token receipts connected to repo + commit + work item + downstream outcome.
- addedarea:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agentsPlugin system, marketplace, hooks, skills, extensions, and custom agentsand removed
on Oct 5, 2026
Metadata
Metadata
Assignees
Labels
area:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agentsPlugin system, marketplace, hooks, skills, extensions, and custom agents
Problem
Copilot CLI emits useful native OpenTelemetry spans for agent activity, model calls, and tool execution. The observed spans already include
gen_ai.*andgithub.copilot.*data such as conversation IDs, model selection, tool names, and input/output/cache/reasoning token usage.However, the agent/model cannot enrich those native spans with delivery context. Span creation and export belong to the Copilot CLI runtime, and Copilot CLI currently exposes no supported agent/runtime API or hook to set attributes on its native OTEL spans. Custom instructions, custom agents, MCP servers, and tools cannot reliably fill this gap.
Requested capability
Provide a governed runtime API/hook that allows a Copilot CLI agent (or approved integration) to add allow-listed custom attributes to native Copilot CLI OTEL spans before export.
Illustrative API:
Goal and use cases
Enable end-to-end correlation of AI-assisted engineering activity with work items, Git changes, and delivery outcomes. An enriched trace/span should support data points such as:
The primary correlation key is repository identity plus commit SHA. That joins Copilot traces to Git commits, merge requests, pipelines, artifacts, deployments, and production outcomes. Ticket and session identifiers provide supporting context. The capability should also support integrations with ticketing systems and approved software-supply-chain/provenance standards.
Requirements
invoke_agent,chat, andexecute_tool.vcs.*andgen_ai.*.Workaround
An OpenTelemetry Collector or OTLP proxy can enrich exported spans externally today. This works for process-wide Git/Jira context, but does not provide agent-aware, per-span enrichment at the point where Copilot CLI creates the spans.
Observed version
GitHub Copilot CLI
1.0.88.