Skip to content

otel: support gen_ai.response.time_to_first_chunk in sqlite store#312938

Merged
zhichli merged 1 commit into
microsoft:mainfrom
zhichli:zhichli/otel-ttfc-genai-semconv
Apr 28, 2026
Merged

otel: support gen_ai.response.time_to_first_chunk in sqlite store#312938
zhichli merged 1 commit into
microsoft:mainfrom
zhichli:zhichli/otel-ttfc-genai-semconv

Conversation

@zhichli
Copy link
Copy Markdown
Member

@zhichli zhichli commented Apr 27, 2026

Summary

The CLI agent runtime is migrating from the vendor-prefixed attribute github.copilot.time_to_first_chunk to the new OTel GenAI semantic-conventions attribute gen_ai.response.time_to_first_chunk. Both encode time-to-first-chunk in seconds. To stay green before, during, and after the runtime rollout, the OTel sqlite store's _ttftMs() now reads either attribute (preferring the new one) when denormalizing TTFT into the ttft_ms column.

Changes

  • extensions/copilot/src/platform/otel/node/sqlite/otelSqliteStore.ts_ttftMs() checks gen_ai.response.time_to_first_chunk first, falls back to github.copilot.time_to_first_chunk.
  • extensions/copilot/src/platform/otel/node/sqlite/test/otelSqliteStore.spec.ts — Adds two unit tests:
    1. New attribute alone is denormalized to ttft_ms (ms).
    2. New attribute wins when both are present.

gen_ai.request.stream (the other new attribute in the upstream PR) has no current consumer here, so no shim is needed — it flows through as a normal span attribute.

Verification

npx vitest --run --pool=forks src/platform/otel/node/sqlite/test/otelSqliteStore.spec.ts
# Test Files  1 passed (1) / Tests  13 passed (13)

References

Copilot AI review requested due to automatic review settings April 27, 2026 23:55
The CLI runtime is migrating from the vendor-prefixed
github.copilot.time_to_first_chunk attribute to the OTel GenAI
semconv attribute gen_ai.response.time_to_first_chunk. Both encode
TTFT in seconds. The sqlite store's _ttftMs() now reads either
name (preferring the new one) so we keep populating ttft_ms before,
during, and after the runtime rollout.

Adds two unit tests: one for the new attribute alone, one verifying
the new attribute wins when both are present.

Refs:
  open-telemetry/semantic-conventions#3607
  github/copilot-agent-runtime#6949
@zhichli zhichli force-pushed the zhichli/otel-ttfc-genai-semconv branch from 62f0e48 to b804497 Compare April 27, 2026 23:57
@zhichli zhichli enabled auto-merge April 27, 2026 23:58
@zhichli zhichli merged commit d1f9c7f into microsoft:main Apr 28, 2026
26 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.119.0 milestone Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants