Repository navigation
feat(attributes): Add Vercel AI runtime and tool context attributes - #756
Merged
Merged
Conversation
Add `vercel.ai.settings.context.<key>` and `vercel.ai.tool_call.context.<key>`. `ai` 7 removed `telemetry.metadata`. Per-call metadata now goes in `runtimeContext` and `toolsContext`. The app opts keys into telemetry with `telemetry.includeRuntimeContext` and `telemetry.includeToolsContext`. The Vercel AI integration in sentry-javascript records the included keys on gen_ai spans (getsentry/sentry-javascript#25774). The runtime context name matches `@ai-sdk/otel`, which emits `ai.settings.context.<key>`, under the usual `ai.*` to `vercel.ai.*` renaming. `@ai-sdk/otel` does not record tool context, so the tool context name uses snake_case for its fixed segments. The type is `string`, as for `vercel.ai.telemetry.metadata.<key>`. Context values can have any type, so SDKs convert them to strings. `ai` versions before 7.0.114 publish the full context on the `ai:telemetry` channel and ignore the include lists. The attributes tell SDKs to read context only from events that carry `aiVersion` (added in `ai` 7.0.154), so keys the app did not opt in are not sent. Related: getsentry/sentry-javascript#24706 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
isaacs
requested review from
a team,
Lms24,
alexander-alderman-webb,
cleptric,
giortzisg,
mjq and
nsdeschenes
as code owners
October 28, 2026 23:07
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Attributes
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Lms24
approved these changes
Oct 29, 2026
Lms24
left a comment
Member
There was a problem hiding this comment.
Thanks! LGTM from my PoV but would appreciate someone more versed in gen_ai telemetry taking another look!
alexander-alderman-webb
approved these changes
Oct 30, 2026
alexander-alderman-webb
left a comment
Contributor
There was a problem hiding this comment.
No strong opinion on this. I don't think there's overlap with existing gen_ai.* attributes.
isaacs
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Oct 30, 2026
…el AI spans (#25774) On `ai` 7 the `telemetry.metadata` option is gone. Per-call metadata goes in `runtimeContext`, and the app opts keys into telemetry with `telemetry.includeRuntimeContext` (and `includeToolsContext` for tool context). The channel subscriber did not read either field, so there was no way to put request-level data on gen_ai spans. The subscriber now records each included `runtimeContext` key as `vercel.ai.settings.context.<key>` on the operation span and on its `generate_content` and `execute_tool` child spans. It records each included `toolContext` key as `vercel.ai.toolCall.context.<key>` on the `execute_tool` span. The `runtimeContext` names match `@ai-sdk/otel` (`ai.settings.context.*`) under the usual `ai.*` to `vercel.ai.*` renaming. `ai` before 7.0.114 published the full context to the channel and ignored the include lists. A filtered context looks the same as an unfiltered one, so the subscriber only reads context from events that carry `aiVersion`, which `ai` added in 7.0.154. Older 7.x versions record no context, so keys the app did not opt in never leave it. Fixes #24706 Fixes JS-3788 Refs getsentry/sentry-conventions#756 Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch was successfully deployed
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.
Add
vercel.ai.settings.context.<key>andvercel.ai.tool_call.context.<key>.ai7 removedtelemetry.metadata. Per-call metadata now goes inruntimeContextandtoolsContext. The app opts keys into telemetry withtelemetry.includeRuntimeContextandtelemetry.includeToolsContext. The Vercel AI integration in sentry-javascript records the included keys on gen_ai spans (getsentry/sentry-javascript#25774).The runtime context name matches
@ai-sdk/otel, which emitsai.settings.context.<key>, under the usualai.*tovercel.ai.*renaming.@ai-sdk/oteldoes not record tool context, so the tool context name uses snake_case for its fixed segments.The type is
string, as forvercel.ai.telemetry.metadata.<key>. Context values can have any type, so SDKs convert them to strings.aiversions before 7.0.114 publish the full context on theai:telemetrychannel and ignore the include lists. The attributes tell SDKs to read context only from events that carryaiVersion(added inai7.0.154), so keys the app did not opt in are not sent.Related: getsentry/sentry-javascript#24706