Commit f071abb
fix: align OTEL attributes with gen_ai semconv spec (#3488)
* fix: use --build-local in smoke-otel-tracing to test latest api-proxy code
The workflow was using --skip-pull with pre-built GHCR images (v0.25.29)
which don't include the recently-merged otel.js module. Switch to
--build-local so the api-proxy container is built from source and
includes the OTEL tracing implementation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: inject stream_options for token tracking in spans
Streaming OpenAI/Copilot API responses only include usage data in the
final SSE chunk when the client sends stream_options: {include_usage: true}.
Without this, the token tracker never extracts usage and OTEL spans have
no gen_ai.usage.* attributes.
The api-proxy now injects this option automatically for OpenAI-compatible
providers (copilot, openai, opencode) when stream: true is set and
stream_options is not already present.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: align OTEL attributes with gen_ai semconv spec
Rename attributes to match the OpenTelemetry GenAI semantic conventions:
- awf.provider → gen_ai.provider.name
- gen_ai.system → removed (deprecated)
- awf.cache_read_tokens → gen_ai.usage.cache_read.input_tokens
- awf.cache_write_tokens → gen_ai.usage.cache_creation.input_tokens
- awf.streaming → gen_ai.request.stream
Add new standard attributes:
- gen_ai.operation.name (set to 'chat')
- gen_ai.usage.reasoning.output_tokens
Reference: https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 565cef7 commit f071abb
2 files changed
Lines changed: 20 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
419 | 421 | | |
420 | | - | |
421 | 422 | | |
422 | 423 | | |
423 | 424 | | |
| |||
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
452 | 454 | | |
453 | 455 | | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
458 | 461 | | |
459 | 462 | | |
460 | 463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
237 | | - | |
238 | | - | |
239 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
0 commit comments