Skip to content

Commit 981a358

Browse files
ryoppippijay-tau
andcommitted
docs(copilot): clarify post-shutdown OTel filtering
Document the timestamp boundary for matching OpenTelemetry rows. Rows at or before the latest canonical shutdown are suppressed, while rows emitted after shutdown by a resumed session remain included. Co-authored-by: Joel Tony <[email protected]>
1 parent 46c89a9 commit 981a358

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎docs/guide/copilot/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pnpm dlx ccusage copilot --help
2626

2727
The CLI reads Copilot session-state shutdown events from `${COPILOT_HOME:-~/.copilot}/session-state/*/events.jsonl` by default. It also reads OpenTelemetry JSONL files from `${COPILOT_HOME:-~/.copilot}/otel/*.jsonl` and includes the explicit file pointed to by `COPILOT_OTEL_FILE_EXPORTER_PATH`. Set `COPILOT_HOME` to the Copilot data root when the default `~/.copilot` directory has been relocated.
2828

29-
Session-state files do not require OpenTelemetry configuration. Shutdown usage is cumulative per canonical session/model pair, so only the latest shutdown is retained. When both sources contain the same session/model pair, the session-state usage is used and the matching OpenTelemetry rows are skipped. OpenTelemetry rows for other session/model pairs remain available.
29+
Session-state files do not require OpenTelemetry configuration. Shutdown usage is cumulative per canonical session/model pair, so only the latest shutdown is retained. When both sources contain the same session/model pair, the session-state usage is used and matching OpenTelemetry rows are suppressed only when their timestamps are at or before the latest canonical shutdown timestamp for that pair; rows emitted after that timestamp by a resumed session are retained. OpenTelemetry rows for other session/model pairs remain available.
3030

3131
Only `session.shutdown` events and their `data.modelMetrics.<model>.usage` fields are used. In session-state data, `inputTokens` includes both cache buckets, so ccusage derives uncached input as `max(inputTokens - cacheReadTokens - cacheWriteTokens, 0)` before populating `inputTokens`; cache reads and cache writes are then reported separately. `reasoningTokens` is a subset of `outputTokens`, so it is not added again to output, total tokens, or cost. The session-state `requests.cost` field is not treated as a USD cost; costs continue to use ccusage's normal token pricing. Copilot model IDs with `-1m` or `-1m-internal` suffixes, such as `claude-opus-4.6-1m`, are normalized to their priced model name for pricing and source deduplication.
3232

‎rust/adapters/copilot/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ Anything that is not specific to this source belongs in `ccusage-core` or
2222

2323
Session-state shutdown records are cumulative per canonical `(session, model)` pair, so only the
2424
latest shutdown is retained. They are preferred for a matching pair when both sources contain it.
25-
Other OpenTelemetry records remain available. Session-state `inputTokens` includes cache reads
25+
Matching OpenTelemetry rows are suppressed only when their timestamps are at or before the latest
26+
canonical shutdown timestamp for that pair; rows emitted after that timestamp by a resumed session
27+
are retained. Other OpenTelemetry records remain available. Session-state `inputTokens` includes cache reads
2628
and writes, so the adapter reports the uncached remainder as input and keeps the cache buckets
2729
separate. Reasoning tokens are already included in output tokens and are not added to totals or
2830
costs. Internal model suffixes such as `-1m` and `-1m-internal` are removed before pricing and

0 commit comments

Comments
 (0)