Repository navigation
Description
What do you want to change?
Now that #1174 makes session-state the default Copilot data source, the OTel file-export path adds maintenance burden without giving users data they can't already get from session-state. Propose to delete the OTel parser, its env vars, and the OTel↔session-state coexistence dance in a follow-up PR.
Why?
After #1174, session-state is strictly more useful than OTel for ccusage's aggregation purposes:
| Data | session-state | OTel | Used by ccusage |
|---|---|---|---|
| Per-model token totals | ✅ | ✅ | yes |
totalNanoAiu (true AI-credit bill, post-2026-06-01) |
✅ | ❌ | yes — drives auto / credits / display |
requests.cost (pre-cutover premium-requests) |
✅ | ❌ | yes — drives auto for pre-cutover sessions |
| Per-API-call trace/span IDs | ❌ | ✅ | no — ccusage aggregates by day/month/session |
| Per-call duration / latency | ❌ | ✅ | no |
| Distributed-tracing parent/child links | ❌ | ✅ | no |
| Available without setup | ✅ (written on every install) | ❌ (env var + exporter setup required) | n/a |
OTel's remaining advantages — per-call granularity and distributed-tracing context — are real, but ccusage surfaces none of them. Anyone who actually wants the per-call view should run a proper OTel pipeline (Jaeger, Tempo, an OTel collector), not file-export + ccusage.
What we pay to keep OTel after #1174:
- ~500 LoC of parser code with chat-span / inference-log / agent-turn / agent-summary-span dispatch and priority-based dedup logic.
COPILOT_OTEL_DEDUP=loose|strict|offenv var, invented specifically because we cannot verify whether OTel'ssession_id(resolved fromgen_ai.conversation.id/copilot_chat.session_id/session.id/github.copilot.interaction_id/gen_ai.response.idin priority order) matches the session-state directory UUID. Fragile and unverified by definition.COPILOT_PREFER_OTEL=1inversion that lets users opt in to the worse data source.- Three extra env vars in the user-facing surface plus a coexistence section in the Copilot guide.
Removing OTel closes both #1174 and #956 cleanly and eliminates the unverified ID-namespace assumption.
How? (optional)
- Delete the OTel functions in
rust/crates/ccusage/src/adapter/copilot/parser.rs(parse_otel_file,CopilotUsageSource,CandidateSets,to_candidate, theis_*_recordfamily, and the trace-context helpers). - Remove the
Otelvariant fromCopilotSourceinpaths.rsand dropCOPILOT_OTEL_FILE_EXPORTER_PATHreading. - Remove
apply_coexistence_rulefromloader.rs; the loader iterates session-state files directly. - Remove
COPILOT_OTEL_DEDUP_ENVandCOPILOT_PREFER_OTEL_ENVconstants and their tests. - Update
docs/guide/copilot/index.md,docs/guide/environment-variables.md, anddocs/guide/configuration.mdto drop OTel mentions.
Breaking-change scope: users with OTel-only historical data and no session-state would lose the ability to analyze that data via ccusage. Realistic impact is small — session-state predates the AI-credits cutover and ships on every Copilot CLI install — but worth calling out in the changelog.
Activity
github-actions commentedon Jun 5, 2026
This issue was auto-closed. Issues from new contributors are auto-closed by default.
Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply.
Keep the issue short, concrete, and written in your own voice.
If a maintainer replies
lgtmi, your future issues will stay open. If a maintainer replieslgtm, your future issues and PRs will stay open.See CONTRIBUTING.md.
refactor(adapter/copilot): stop reading OpenTelemetry data
perf(adapter/copilot): stream events.jsonl via BufReader; document u6…
refactor(adapter/copilot): drop unused _event_id param + trim 3 multi…
refactor(adapter/copilot): remove legacy OTel parser and its tests
refactor(adapter/copilot): stop reading OpenTelemetry data
perf(adapter/copilot): stream events.jsonl via BufReader; document u6…
refactor(adapter/copilot): drop unused _event_id param + trim 3 multi…
refactor(adapter/copilot): remove legacy OTel parser and its tests
refactor(adapter/copilot): drop unused _event_id param + trim 3 multi…
refactor(adapter/copilot): remove legacy OTel parser and its tests
refactor(adapter/copilot): remove legacy OTel parser and its tests
refactor(adapter/copilot): stop reading OpenTelemetry data
perf(adapter/copilot): stream events.jsonl via BufReader; document u6…
refactor(adapter/copilot): drop unused _event_id param + trim 3 multi…
refactor(adapter/copilot): remove legacy OTel parser and its tests
perf(adapter/copilot): stream events.jsonl via BufReader; document u6…
refactor(adapter/copilot): drop unused _event_id param + trim 3 multi…
refactor(adapter/copilot): remove legacy OTel parser and its tests
refactor(adapter/copilot): drop unused _event_id param + trim 3 multi…
refactor(adapter/copilot): remove legacy OTel parser and its tests
ryoppippi commentedon Aug 31, 2026
Historical audit: this discussion was auto-closed by the legacy contributor gate. That closure did not assess technical importance.
Audit result: maintainable candidate. The request fits the current ccusage scope and can be evaluated with repository-owned code or fixtures, without vendor credentials or platform-specific release infrastructure. It remains closed for now; reopen only after confirming current relevance and expected behavior.
YAMLcase commentedon Oct 6, 2026
@jay-tau
I launch vscode from inside WSL2 and use copilot chat there, not the copilot CLI. Removing the OTel parser would leave me with no Copilot data in ccusage. vscode copilot chat doesn't write session-state files, so the OTel file exporter in its settings is the only local usage source.
The table also says OTel has no AI-credit data. vscode chat spans carry copilot_chat.copilot_usage_nano_aiu, which the extension copies from the API response. It uses the same nano-AIU unit as session-state's totalNanoAiu. Here is a trimmed chat span with fake values, where 12,500,000,000 nano-AIU is 12.5 credits, or $0.125:
{ "name": "chat claude-opus-5.5", "traceId": "0123456789abcdef0123456789abcdef", "spanId": "0123456789abcdef", "endTime": [1790000000, 0], "attributes": { "gen_ai.operation.name": "chat", "gen_ai.response.model": "claude-opus-5.5", "gen_ai.conversation.id": "00000000-0000-0000-0000-000000000000", "gen_ai.usage.input_tokens": 50000, "gen_ai.usage.output_tokens": 500, "gen_ai.usage.cache_read.input_tokens": 40000, "gen_ai.usage.cache_creation.input_tokens": 9000, "copilot_chat.copilot_usage_nano_aiu": 12500000000 } }For vscode users, OTel is the only source of per-request credit cost. Please keep it.