You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dab0e5d
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(adapter/copilot): remove legacy OTel parser and its tests
The production loader has been reading session-state events.jsonl
exclusively since the start of this PR series. The OTel parser had
been carried under #[allow(dead_code)] pending ccusage#1208, but ccusage#1208 was
auto-closed by the contribution gate, so folding the removal in here
avoids leaving an orphaned dead-code parser with no tracked owner.
Removed
-------
* parse_otel_file and ~500 lines of OTel-specific helpers
(CopilotUsageSource, CopilotUsageCandidate, trace context
collection, span/log classification, OTel attribute readers,
span-id/trace-id extraction, OTel timestamp parsers).
* 4 OTel parser tests in loader.rs::tests
(parses_copilot_chat_spans, suppresses_lower_priority_records_*,
includes_reasoning_tokens_in_total_tokens,
falls_back_to_total_tokens_when_copilot_parts_are_missing).
* Now-unused imports: HashSet, serde_json::Map, apply_total_token_fallback,
TokenUsageRaw (parser.rs); fs_fixture, parse_otel_file, AgentReportKind,
report_from_rows, summarize_entries (loader.rs).
* OTel-mentioning doc fragments in nano_aiu, premium_request_cost,
the loader's mode-dispatch comment, the OTel-coexistence-tests
placeholder, and the per-file-isolation test header.
* The "Legacy OpenTelemetry parser" README section.
Retained (intentionally)
------------------------
* file_modified_timestamp helper (moved into the session-state
section; used by parse_session_state_file's fallback timestamp).
* The OTel env-var deprecation warning surface
(warn_about_inert_legacy_env_vars_once, LEGACY_OTEL_ENV_VARS,
legacy_otel_env_vars_in_use) and its tests. This is the user-facing
notice on first run after upgrade; users who had
COPILOT_OTEL_FILE_EXPORTER_PATH / COPILOT_OTEL_DEDUP /
COPILOT_PREFER_OTEL set still need to learn those are inert.
* The otel/ directory ignore tests (paths.rs) and the README section
documenting the env-var deprecation.
Validation
----------
* cargo fmt --check clean.
* cargo clippy --workspace --all-targets -- -D warnings clean.
* cargo test --workspace: 364 passed, 0 failed (was 368: -4 OTel
parser tests). All session-state tests, all aggregation tests, and
the env-var deprecation tests continue to pass.
Diff: 4 files changed, +30 / -711 lines.
Co-authored-by: Copilot <[email protected]>
Copy file name to clipboardExpand all lines: docs/guide/copilot/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ pnpm dlx ccusage copilot --help
24
24
25
25
## Data Source
26
26
27
-
The Copilot CLI writes per-session events to `~/.copilot/session-state/<sessionId>/events.jsonl`on every install — no configuration is required.
27
+
The Copilot CLI writes per-session events to `~/.copilot/session-state/<sessionId>/events.jsonl`automatically during each CLI session — no configuration is required.
- GitHub Copilot CLI: `${COPILOT_CONFIG_DIR:-~/.copilot}/session-state/<sessionId>/events.jsonl` (written by the CLI on every install)
178
+
- GitHub Copilot CLI: `${COPILOT_CONFIG_DIR:-~/.copilot}/session-state/<sessionId>/events.jsonl` (written automatically by the CLI during each session)
The Copilot CLI writes `session-state/<uuid>/events.jsonl` on every install.
9
+
The Copilot CLI writes `session-state/<uuid>/events.jsonl`automatically during each CLI session, appending a `session.shutdown` event on graceful exit.
10
10
11
11
## session-state schema
12
12
@@ -95,8 +95,12 @@ shutdown means** — because real-data shapes differ between the two paths:
95
95
report time), even if their token counts happen to coincide. This is correct
96
96
because per-process snapshots commonly produce near-identical counts when a
97
97
user resumes a similar workload, and treating them as duplicates would
98
-
silently under-count usage. Pinned by
99
-
`token_bearing_rows_keep_event_id_dedup_key_not_content_based` and
98
+
silently under-count usage. The `session_id` prefix is defense-in-depth:
99
+
today every observed `event.id` is a globally-unique UUID, but prefixing
100
+
with `session_id` guards against a hypothetical future Copilot CLI that
101
+
scopes event ids per-session, which would otherwise silently collapse
102
+
distinct sessions' rows in the loader's final `HashMap`-keyed dedup. Pinned
103
+
by `token_bearing_rows_keep_event_id_dedup_key_not_content_based` and
0 commit comments