Skip to content

chore(adapter/copilot): remove OpenTelemetry data source after #1174 #1208

Description

@jay-tau

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|off env var, invented specifically because we cannot verify whether OTel's session_id (resolved from gen_ai.conversation.id / copilot_chat.session_id / session.id / github.copilot.interaction_id / gen_ai.response.id in priority order) matches the session-state directory UUID. Fragile and unverified by definition.
  • COPILOT_PREFER_OTEL=1 inversion 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)

  1. Delete the OTel functions in rust/crates/ccusage/src/adapter/copilot/parser.rs (parse_otel_file, CopilotUsageSource, CandidateSets, to_candidate, the is_*_record family, and the trace-context helpers).
  2. Remove the Otel variant from CopilotSource in paths.rs and drop COPILOT_OTEL_FILE_EXPORTER_PATH reading.
  3. Remove apply_coexistence_rule from loader.rs; the loader iterates session-state files directly.
  4. Remove COPILOT_OTEL_DEDUP_ENV and COPILOT_PREFER_OTEL_ENV constants and their tests.
  5. Update docs/guide/copilot/index.md, docs/guide/environment-variables.md, and docs/guide/configuration.md to 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.

Refs #1174, #956

Activity

  1. github-actions commented on Jun 5, 2026

    @github-actions
    Contributor

    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 replies lgtm, your future issues and PRs will stay open.

    See CONTRIBUTING.md.

  2. added 20 commits that reference this issue on Jun 5, 2026
  3. ryoppippi commented on Aug 31, 2026

    @ryoppippi
    Member

    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.

  4. YAMLcase commented on Oct 6, 2026

    @YAMLcase

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage:maintainableFits the repository's maintainable scope and needs review.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions