vercelAIIntegration: record AI SDK v7 runtimeContext (filtered by telemetry.includeRuntimeContext) as span attributes
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- observability
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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").
- Linguagem predominante
- TypeScript
- Estrelas
- 8.7k
- Forks
- 1.9k
- Merge médio
- 1d 17h
- PRs com merge (30d)
- 543
Preparar o ambiente
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de getsentry/sentry-javascript
-
Browser Bug Next.js Traces
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
getsentry/sentry-javascript#24672 · 2 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
javascript
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
getsentry/sentry-javascript#24200 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
javascript Task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
getsentry/sentry-javascript#24134 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Cloudflare Workers javascript Tests
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
getsentry/sentry-javascript#24051 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Bug Bun javascript
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 92/100
getsentry/sentry-javascript#24045 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de getsentry/sentry-javascript
Issues semelhantes
-
module-request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
ports get and web print 'Port N already in use, trying next...' for every busy port they skipAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
appandflow/stim#1604 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
lingdojo/kana-dojo#31060 · 1 comentário · 5 reações ·
Mantenedores costumam responder em até 1 dia
-
SSH workspace restore rewrites relative symlinks into the deleted sync-back staging directoryAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
paperclipai/paperclip#14173 ·
Mantenedores costumam responder em até 1 dia
-
needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia