Skip to content

sanitize OpenAI tracing export payloads#2896

Merged
alfozan merged 1 commit intomainfrom
alfozan/sanitize-tracing-usage-export
Apr 15, 2026
Merged

sanitize OpenAI tracing export payloads#2896
alfozan merged 1 commit intomainfrom
alfozan/sanitize-tracing-usage-export

Conversation

@alfozan
Copy link
Copy Markdown
Contributor

@alfozan alfozan commented Apr 15, 2026

Summary

Updates the OpenAI tracing exporter to align usage metadata with the trace ingest payload shape.

For the default OpenAI tracing endpoint, usage metadata is now only included on generation spans, where it is normalized to the supported token-count shape. Other tracing endpoints continue to receive the raw SDK payload.

Adds regression coverage for OpenAI endpoint sanitization and custom endpoint behavior.

Test plan

  • make format
  • make lint
  • make sync && make typecheck
  • uv run pytest tests/test_openai_responses.py::test_get_response_span_exports_usage tests/test_trace_processor.py (46 passed)
  • Manual tracing repro: Runner.run(...) completed, flush_traces() completed, and no tracing client errors were emitted.
  • make tests reached 3858 passed, 10 failed locally in sandbox tests because sandbox-exec returned sandbox_apply: Operation not permitted.

Issue number

N/A

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

@seratch seratch added this to the 0.14.x milestone Apr 15, 2026
@github-actions github-actions bot added bug Something isn't working feature:tracing labels Apr 15, 2026
@seratch
Copy link
Copy Markdown
Member

seratch commented Apr 15, 2026

@codex review now

@alfozan alfozan self-assigned this Apr 15, 2026
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@seratch seratch changed the title Sanitize OpenAI tracing export payloads fix: sanitize OpenAI tracing export payloads Apr 15, 2026
@alfozan alfozan merged commit 2cef83b into main Apr 15, 2026
9 checks passed
@alfozan alfozan deleted the alfozan/sanitize-tracing-usage-export branch April 15, 2026 19:19
@alfozan alfozan changed the title fix: sanitize OpenAI tracing export payloads sanitize OpenAI tracing export payloads Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:tracing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants