vercelAIIntegration: record AI SDK v7 runtimeContext (filtered by telemetry.includeRuntimeContext) as span attributes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start at the v7 channel subscriber, especially buildInvokeAgentSpan and the existing callId maps in @sentry/server-utils. Check how runtimeContext is published and how the related vercel/ai filtering fix affects supported versions before tracing child generate_content and execute_tool spans. Done means opted-in requestId and tenantId reach the intended spans, apiToken does not, and coverage verifies the version behavior.
索引モデルが issue の本文から書いたものです。
説明
Problem Statement
AI SDK v7 removed telemetry.metadata. Per-call metadata now goes in runtimeContext, and the app opts keys into telemetry with telemetry.includeRuntimeContext (telemetry docs, runtime context docs). @ai-sdk/otel records the included keys as ai.settings.runtimeContext.*. On v6 the equivalent data arrived through experimental_telemetry.metadata as vercel.ai.telemetry.metadata.*.
The v7 channel subscriber in @sentry/server-utils (vercel-ai-dc-subscriber, added in #21613) never reads runtimeContext, so on v7 there is no way to attach request-level metadata (user, tenant, request id, ...) to gen_ai spans. The integration docs say not to combine registerTelemetry with vercelAIIntegration, so registering @ai-sdk/otel alongside it is not a workaround either.
await streamText({
model,
messages,
runtimeContext: { requestId: 'req_123', tenantId: 'acme', apiToken: 'secret' },
telemetry: {
isEnabled: true,
functionId: 'support-chat',
includeRuntimeContext: { requestId: true, tenantId: true },
},
});
- Expected: the
gen_ai.invoke_agentspan (and ideally itsgen_ai.generate_content/gen_ai.execute_toolchildren) carriesrequestIdandtenantId, and notapiToken. - Actual: none of the keys appear. The span has only
vercel.ai.operationId,vercel.ai.model.provider,vercel.ai.settings.maxRetriesand thegen_ai.*attributes.
Checked against @sentry/node 10.71.0 and the @sentry/server-utils subscriber in 10.75.3 and 11.0.0, with ai 7.0.100 / 7.0.113 on Node.
Solution Brainstorm
- In
buildInvokeAgentSpan, set one attribute perevent.runtimeContextkey.vercel.ai.settings.runtimeContext.<key>would match@ai-sdk/otel'sai.settings.runtimeContext.*under the existingai.*tovercel.ai.*renaming. - Copy the same attributes onto child
generate_content/execute_toolspans through the existingcallIdmaps (likeoperationIdByCallId), since those channel events do not carryruntimeContext. - Optionally, record
event.toolContextonexecute_toolspans, which the AI SDK filters bytelemetry.includeToolsContext.
Dependency on the AI SDK. In ai <= 7.0.113 the channel publishes runtimeContext / toolsContext unfiltered, ignoring includeRuntimeContext (vercel/ai#21442). Reading event.runtimeContext on those versions would send keys the app never opted in to telemetry. The fix is open in vercel/ai#21447, which filters channel events the same way as registered integrations. So this should only read the field on AI SDK versions that include that fix, or otherwise guard against unfiltered context.
Additional Context
#24660 notes the same gap from the Cloudflare Think side ("neither subscriber reads either field").
- 主要言語
- TypeScript
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 543
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-javascript のほかの issue
-
Browser Bug Next.js Traces
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
getsentry/sentry-javascript#24672 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
getsentry/sentry-javascript#24200 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
javascript Task
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
getsentry/sentry-javascript#24134 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Cloudflare Workers javascript Tests
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-javascript#24051 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug Bun javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
getsentry/sentry-javascript#24045 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
getsentry/sentry-javascript の issue をすべて見る
似ている issue
-
ADD openalgoオープンtemplate
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
bug Needs: Triage :mag:
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/fluentui-contrib#671 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
sveltejs/acorn-typescript#150 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100