Skip to content

feat: add span customizers (SDK-316) - #788

Merged
Andrew Kent (realark) merged 1 commit into
mainfrom
ark/SDK-316-span-customizers
Sep 23, 2026
Merged

Andrew Kent (realark) merged 1 commit into
mainfrom
ark/SDK-316-span-customizers

Conversation

@realark

@realark Andrew Kent (realark) commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

AI Generated Description

Summary

Implements SDK-316 using the span customizer specification and the JavaScript reference.

  • Add SpanCustomizer.on_span_export, SpanExportData, set_span_customizers, and auto_instrument(span_customizers=...).
  • Customize native instrumentation records after lazy resolution, before merging, masking, attachments, and serialization. Manual spans, datasets, feedback, and separate OTel exporters remain outside the scope.
  • Preserve identity/routing/merge fields, ordered replacements, immutable registration snapshots, fail-open continuation, and transformed-record reuse on retries.
  • Mark previously unmarked Pipecat and legacy LangChain instrumentation spans; document lifecycle and fail-open redaction risks.

Verification

  • Dedicated customizer suite: 10 passed.
  • Isolated core suite: 863 passed, 64 skipped, 12 xfailed.
  • test_types: pyright/mypy clean, 35 runtime tests passed.
  • Pipecat customizer regression passed on 1.3.0 and latest (1.10.0).
  • Standalone SDK smoke: incremental input/output redaction, stable span identity, manual-span exclusion.
  • Changed-file pre-commit checks passed.

The core suite required clearing local Braintrust endpoint environment overrides to match recorded cassettes. It exits successfully but prints an atexit closed-output-stream warning. No cassettes were changed.

Contract note

Like JavaScript, failures are fail open. Throwing is not a safe way to block export; the API docs state this explicitly.

@realark
Andrew Kent (realark) force-pushed the ark/SDK-316-span-customizers branch 4 times, most recently from 0bae7f4 to cbcc96b Compare September 23, 2026 19:27
@realark
Andrew Kent (realark) marked this pull request as ready for review September 23, 2026 19:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-23T19:32:00.403452Z cbcc96b Draft marked ready
ℹ️ About Codex in GitHub

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

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbcc96b492

ℹ️ 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 (@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 (@codex) address that feedback".

Comment thread py/src/braintrust/logger.py
Comment thread py/README.md Outdated
add customizers and re-implement masking fn with a customizer
@realark
Andrew Kent (realark) enabled auto-merge (squash) September 23, 2026 21:43
@realark
Andrew Kent (realark) merged commit 6715165 into main Sep 23, 2026
83 checks passed
@realark
Andrew Kent (realark) deleted the ark/SDK-316-span-customizers branch September 23, 2026 21:48
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