feat(evals): bump braintrust to 3.x; first-party BraintrustSpanProcessor OTEL sink#2355
Open
miguelg719 wants to merge 2 commits into
Open
Conversation
|
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Confidence score: 5/5
- Safe to merge after the addressed issues were fixed.
Architecture diagram
sequenceDiagram
participant App as otel.ts (initializeTracerProvider)
participant Provider as NodeTracerProvider
participant Processor as BraintrustSpanProcessor
participant BraintrustAPI as Braintrust API
Note over App,BraintrustAPI: NEW: First‑party span processor replaces generic OTLP exporter
App->>App: Read BRAINTRUST_API_KEY
alt API key present
App->>App: Derive project name (stagehand/stagehand-dev) from CI flag
App->>App: Read BRAINTRUST_OTEL_PARENT (default: project_name:…)
App->>App: Read BRAINTRUST_OTEL_URL
opt BRAINTRUST_OTEL_URL set
App->>App: Strip suffix /otel/v1/traces to get apiUrl
end
App->>Processor: new BraintrustSpanProcessor({apiKey, parent, filterAISpans: false, apiUrl?})
Note over Processor: filterAISpans: false ensures manual spans (task/agent/verifier) reach Braintrust
Processor->>BraintrustAPI: Authenticate with apiKey
App->>Provider: addSpanProcessor(Processor)
end
Note over App: Also still configures LangSmith exporter if enabled
Note over Provider,BraintrustAPI: During evaluation run
Provider->>Processor: onStart(span)
Processor->>Processor: Check filterAISpans (false → always pass)
Processor->>Processor: Enrich span with parent context
loop Every batch or scheduled flush
Processor->>BraintrustAPI: Export spans (via Braintrust OTLP endpoint)
BraintrustAPI-->>Processor: Acknowledge
end
Provider->>Processor: shutdown()
Processor->>BraintrustAPI: Final flush
BraintrustAPI-->>Processor: Complete
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
ceaf31f to
24f88b9
Compare
…r for OTEL sink Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…cover BRAINTRUST_OTEL_URL apiUrl derivation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dd2ef3e to
bf90266
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
why
@braintrust/otelrequiresbraintrust>=1.0(every published version), so the pinned 0.4.x blocked the first-party OTEL processor. 3.x unlocks it — richerai.*span handling than a generic OTLP exporter.what changed
braintrust^0.4.10→^3.21.0(all used exports verified intact:Eval,flush,traced,wrapAISDK,loginToState);@braintrust/oteladdedframework/otel.ts: Braintrust sink →BraintrustSpanProcessor({ apiKey, parent, filterAISpans: false })(falseso manual task/agent/verifier spans reach Braintrust too);BRAINTRUST_OTEL_URL→apiUrllib/AISdkClientWrapped.ts: typing-only fix (ReturnType<wrapAISDK>collapses in 3.x) — no runtime change@opentelemetry/exporter-trace-otlp-protodep removedtest plan
evals experimentsagainst live Braintrust (report-layer parity); dual-backend otel run (env: browserbase)Stack 5/5 · base: #2354
🤖 Generated with Claude Code
Summary by cubic
Upgrade
braintrustto 3.x and switch our OTEL sink to the first‑partyBraintrustSpanProcessor. This improvesai.*span capture, removes the generic OTLP exporter, and updates tests to cover parent override andBRAINTRUST_OTEL_URL→apiUrlderivation.New Features
BraintrustSpanProcessor({ apiKey, parent, filterAISpans: false })for Braintrust traces.BRAINTRUST_OTEL_URLis set, deriveapiUrlby stripping/otel/v1/traces.Dependencies
braintrustfrom^0.4.10to^3.21.0.@braintrust/otel^0.2.1.@opentelemetry/exporter-trace-otlp-proto.AISdkClientWrappedforwrapAISDK(no runtime change).Written for commit bf90266. Summary will update on new commits.