Skip to content

feat(server-utils): Implement orchestrion-based instrumentation for vercel-ai v6 - #21658

Merged
mydea merged 14 commits into
developfrom
fn/try-orchestrion
Jul 3, 2026
Merged

feat(server-utils): Implement orchestrion-based instrumentation for vercel-ai v6#21658
mydea merged 14 commits into
developfrom
fn/try-orchestrion

Conversation

@mydea

@mydeamydea commented Jun 19, 2026

Copy link
Copy Markdown
Member

When using orchestrion, this replaces the regular vercelAiIntegration with the channel-variant. This today supports vercel ai v6 and v7 (v5/v4 support TBD).

Test coverage exists and everything passes. This does not add any event processors etc. anymore, everything works inside of the integrations.

OTEL Spans emitted directly by vercel-ai v6 or below are ignored to avoid double instrumentation.

@mydeamydea self-assigned this Jun 19, 2026
Comment threadpackages/server-utils/src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts Outdated
Comment threadpackages/server-utils/src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts Outdated
Comment threaddev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts Outdated
@mydea
mydeaforce-pushed the fn/vercel-ai-v7 branch 9 times, most recently from 9145703 to abad3a9CompareJune 25, 2026 11:33
Base automatically changed from fn/vercel-ai-v7 to developJune 25, 2026 13:20
@mydea
mydeaforce-pushed the fn/try-orchestrion branch from 3417464 to d05d40eCompareJune 26, 2026 11:13
Comment threadpackages/opentelemetry/src/asyncContextStrategy.ts Outdated
Comment threadpackages/core/src/asyncContext/index.ts Outdated
@github-actions

github-actionsBot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.59 kB--
@sentry/browser - with treeshaking flags26.03 kB--
@sentry/browser (incl. Tracing)46.24 kB--
@sentry/browser (incl. Tracing + Span Streaming)48.01 kB--
@sentry/browser (incl. Tracing, Profiling)51.01 kB--
@sentry/browser (incl. Tracing, Replay)85.49 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags75.1 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)90.19 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)102.84 kB--
@sentry/browser (incl. Feedback)44.76 kB--
@sentry/browser (incl. sendFeedback)32.38 kB--
@sentry/browser (incl. FeedbackAsync)37.51 kB--
@sentry/browser (incl. Metrics)28.67 kB--
@sentry/browser (incl. Logs)28.91 kB--
@sentry/browser (incl. Metrics & Logs)29.59 kB--
@sentry/react29.38 kB--
@sentry/react (incl. Tracing)48.51 kB--
@sentry/vue33.03 kB--
@sentry/vue (incl. Tracing)48.11 kB--
@sentry/svelte27.61 kB--
CDN Bundle30 kB--
CDN Bundle (incl. Tracing)48.24 kB--
CDN Bundle (incl. Logs, Metrics)31.57 kB--
CDN Bundle (incl. Tracing, Logs, Metrics)49.54 kB--
CDN Bundle (incl. Replay, Logs, Metrics)70.77 kB--
CDN Bundle (incl. Tracing, Replay)85.7 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)87 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)91.49 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)92.78 kB--
CDN Bundle - uncompressed89.35 kB--
CDN Bundle (incl. Tracing) - uncompressed145.96 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed94.05 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed149.93 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed218.59 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed264.97 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed268.93 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed278.68 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed282.62 kB--
@sentry/nextjs (client)50.95 kB--
@sentry/sveltekit (client)46.65 kB--
@sentry/core/server78.38 kB--
@sentry/core/browser64.73 kB--
@sentry/node-core63.2 kB--
@sentry/node123.2 kB+0.02%+22 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection)69.95 kB--
@sentry/node/light50.72 kB-0.01%-1 B 🔽
@sentry/node - without tracing74.24 kB+0.01%+1 B 🔺
@sentry/aws-serverless85.02 kB--
@sentry/cloudflare (withSentry) - minified181.56 kB--
@sentry/cloudflare (withSentry)449.18 kB--

View base workflow run

@mydea
mydeaforce-pushed the fn/try-orchestrion branch from d05d40e to 98fac43CompareJune 29, 2026 09:42
@mydeamydea changed the title WIP: Implement orchestrion-based instrumentation for vercel-ai v6feat(server-utils): Implement orchestrion-based instrumentation for vercel-ai v6Jun 29, 2026
@mydea
mydea marked this pull request as ready for review June 29, 2026 09:42
@mydea
mydea requested a review from a team as a code ownerJune 29, 2026 09:42
@mydea
mydea requested review from JPeer264 and andreiborza and removed request for a teamJune 29, 2026 09:42
Comment threadpackages/server-utils/src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts Outdated

@JPeer264JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Haven't found any major issues. Tests are failing though and clanker has some objections

Comment threadpackages/server-utils/src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts Outdated
Comment threadpackages/server-utils/src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts Outdated
return isRecord(model) ? asString(model[field]) : undefined;
}

function asString(value: unknown): string | undefined {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

super-l: Maybe it makes sense to outsource these functions in a helper? vercel-ai-dc-subscriber.ts is also using some of the helpers

@mydea
mydeaforce-pushed the fn/try-orchestrion branch from 05fd48d to 89bf321CompareJune 29, 2026 12:57
Comment threadpackages/server-utils/src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts Outdated
Comment threadpackages/server-utils/src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts Outdated
// A single model instance shared by two concurrent `streamText` calls carries only one
// captured-parent slot, so both model calls must still land under their own `invoke_agent` — not
// collapse onto whichever operation resolved the shared model last.
test.skipIf(version === '7' && nodeVersion === 18)(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

q: Why are we skipping this test on v7?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

added a better comment here!

Comment on lines +30 to +34
* Like the v7 subscriber, each operation channel is wired up via
* {@link bindTracingChannelToSpan}, which binds the opened span into the runtime's
* async context for the duration of the traced call and ends it when the call
* settles. That binding is what lets the model call below find its enclosing
* `invoke_agent` span via the active context (see {@link resolveModelCallParent}).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: I'd drop this, it doesn't really add much for understanding, it explains bindTracingChannelToSpan which should already be explained elsewhere.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

this has all been refactored a bit and is hopefully easier/cleaner to understand now.

@mydea
mydeaforce-pushed the fn/try-orchestrion branch from c3f5431 to b26e0cfCompareJuly 2, 2026 07:24
Comment threadpackages/server-utils/src/orchestrion/config.ts
@mydea
mydeaforce-pushed the fn/try-orchestrion branch from b26e0cf to d82519dCompareJuly 2, 2026 08:26
Comment threadpackages/server-utils/src/vercel-ai/vercel-ai-orchestrion-v6-subscriber.ts Outdated
@mydea
mydeaforce-pushed the fn/try-orchestrion branch 2 times, most recently from f3e62c4 to 1731a89CompareJuly 3, 2026 05:57

@cursorcursorBot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1731a89. Configure here.

@mydea
mydeaforce-pushed the fn/try-orchestrion branch from 1731a89 to 99cc8cdCompareJuly 3, 2026 11:43
@mydea
mydea enabled auto-merge (squash) July 3, 2026 12:34
@mydea
mydea merged commit 68fe9e8 into developJul 3, 2026
230 checks passed
@mydea
mydea deleted the fn/try-orchestrion branch July 3, 2026 12:54
mydea added a commit that referenced this pull request Jul 6, 2026
This PR just splits up the orchestrion config for instrumentation into a
file per instrumentation, making it a bit cleaner and easier to follow.
This is on top of
#21658
Sign up for freeto 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.

3 participants

@mydea@JPeer264@andreiborza