test(ai): add preserve OpenTelemetry span receiver test #9309
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 220 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.323
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9309"
general
weight: 0.35
crysmags
What does this PR do?
Builds on #9152's fix for #9151 by keeping the delegating OTel span wrapper private and making its forwarding contract exact. Every Span method runs against the real underlying span with the caller's original arguments, while chainable methods return the per-invocation wrapper and
end,setAttributes, andrecordExceptioncontinue publishing the existing diagnostic-channel events.The wrapper remains fresh per invocation, so the AI SDK's shared no-op span is not mutated and each publication keeps the correct invocation context.
Why is this stronger than the implementation on
master?The implementation on
masterfixes the private-field receiver bug, but manually restates each method signature. This version usesapply(span, arguments)so optional arguments, return behavior, and future compatible Span signature changes are forwarded without drift. The helper stays local to the instrumentation and is not exported for tests.Test coverage
TracerProvider, asserting that the original model error is preserved and the emitted span records that error.Verification
git diff --check: passing.