Skip to content

feat(attributes): Add vercel.ai.telemetry.metadata.<key> attribute - #662

Merged
isaacs merged 3 commits into
mainfrom
isaacs/vercel-ai-telemetry-metadata
Oct 6, 2026
Merged

isaacs merged 3 commits into
mainfrom
isaacs/vercel-ai-telemetry-metadata

Conversation

@isaacs

@isaacs isaacs commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

The Vercel AI integration in sentry-javascript records the experimental_telemetry.metadata of an AI SDK call as vercel.ai.telemetry.metadata.<key> span attributes. SDK v10 did this through the AI SDK's own OTel spans. A fix in v11 restores it for ai 4 to 6 (getsentry/sentry-javascript#24721).

The type is string. The AI SDK also allows numbers, booleans and arrays as metadata values, but in practice users pass strings. SDKs convert other values to strings. The attribute stays open-ended on purpose, because the AI SDK does not define the metadata keys.

Related: getsentry/sentry-javascript#24721

PR Checklist

  • I have run yarn test and verified that the tests pass.
  • I have run yarn generate to generate and format code and docs.

If an attribute was added:

  • The attribute is in a namespace (e.g. nextjs.function_id, not function_id)
  • I have used the correct value for apply_scrubbing (i.e. manual or auto. Use never only for values that should never be scrubbed such as IDs)

If an attribute was deprecated:

@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-conventions Ready Ready Preview Oct 5, 2026 4:25pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Attributes

  • Add vercel.ai.telemetry.metadata.<key> attribute by isaacs in #662
  • Add nel.sampling_fraction by loewenheim in #668

Op

  • Add gen_ai.evaluate op by andreiborza in #650
  • Deprecate framework-specific span ops by Lms24 in #622
  • Add span op deprecation support by Lms24 in #621

Bug Fixes 🐛

  • (descriptions) Define template substitution for array values by s1gr1d in #663
  • (gen_ai) Map Anthropic tool results to canonical attribute by obostjancic in #660

Internal Changes 🔧

Deps

  • Bump brace-expansion from 5.0.9 to 5.0.12 by dependabot in #665
  • Bump devalue from 5.9.2 to 5.9.4 by dependabot in #666
  • Bump dompurify from 3.4.13 to 3.4.16 by dependabot in #664

🤖 This preview updates automatically when you update the PR.

isaacs and others added 2 commits October 5, 2026 07:26
The Vercel AI integration in sentry-javascript records the
`experimental_telemetry.metadata` of an AI SDK call as
`vercel.ai.telemetry.metadata.<key>` span attributes. SDK v10 did
this through the AI SDK's own OTel spans. A fix in v11 restores it
for `ai` 4 to 6 (getsentry/sentry-javascript#24721).

The type is `any`. The AI SDK allows strings, numbers, booleans and
arrays of these as metadata values, and the SDK sends them unchanged.
The schema allows only one type per attribute, so `any` is the only
type that covers all of these values.

The docs content schema did not accept `any`, though
`schemas/attribute.schema.json` allows it, as of #273. No attribute
used `any` before.

Related: getsentry/sentry-javascript#24721

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
If vercel ever does make it more strict, we can fold it in somewhere else.
Comment thread docs/src/content.config.ts
@isaacs
isaacs enabled auto-merge (squash) October 5, 2026 18:18
isaacs added a commit to getsentry/sentry-javascript that referenced this pull request Oct 5, 2026
… on gen_ai spans

v10 got `vercel.ai.telemetry.metadata.<key>` attributes from the AI
SDK's own OTel spans. In v11, `ai` 4 to 6 go through the orchestrion
subscriber, which never read `metadata`, so v11 dropped it.

The orchestrion subscriber now passes the metadata to the channel
subscriber, which sets it as span attributes when each span starts.
The `invoke_agent`, `generate_content` and `embeddings` spans get the
attributes, and `execute_tool` spans don't. This matches the AI SDK,
which leaves metadata off its `ai.toolCall` spans.

Values are cast to string, as discussed in the linked sentry-conventions
PR. If this causes a problem we can revisit, but all extant examples
found in the wild are strings already, so it is likely safe, and
extremely cheap.

fixes JS-3800
fixes #24720
Re: #24706
Re: getsentry/sentry-conventions#662

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
isaacs added a commit to getsentry/sentry-javascript that referenced this pull request Oct 5, 2026
… on gen_ai spans

v10 got `vercel.ai.telemetry.metadata.<key>` attributes from the AI
SDK's own OTel spans. In v11, `ai` 4 to 6 go through the orchestrion
subscriber, which never read `metadata`, so v11 dropped it.

The orchestrion subscriber now passes the metadata to the channel
subscriber, which sets it as span attributes when each span starts.
The `invoke_agent`, `generate_content` and `embeddings` spans get the
attributes, and `execute_tool` spans don't. This matches the AI SDK,
which leaves metadata off its `ai.toolCall` spans.

Values are cast to string, as discussed in the linked sentry-conventions
PR. If this causes a problem we can revisit, but all extant examples
found in the wild are strings already, so it is likely safe, and
extremely cheap.

fixes JS-3800
fixes #24720
Re: #24706
Re: getsentry/sentry-conventions#662

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
isaacs added a commit to getsentry/sentry-javascript that referenced this pull request Oct 5, 2026
… on gen_ai spans (#24721)

v10 got `vercel.ai.telemetry.metadata.<key>` attributes from the AI
SDK's own OTel spans. In v11, `ai` 4 to 6 go through the orchestrion
subscriber, which never read `metadata`, so v11 dropped it.

The orchestrion subscriber now passes the metadata to the channel
subscriber, which sets it as span attributes when each span starts. The
`invoke_agent`, `generate_content` and `embeddings` spans get the
attributes, and `execute_tool` spans don't. This matches the AI SDK,
which leaves metadata off its `ai.toolCall` spans.

Values are cast to string, as discussed in the linked sentry-conventions
PR. If this causes a problem we can revisit, but all extant examples
found in the wild are strings already, so it is likely safe, and
extremely cheap.

fixes JS-3800
fixes #24720
Re: #24706
Re: getsentry/sentry-conventions#662

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@isaacs
isaacs merged commit 8ec3504 into main Oct 6, 2026
19 checks passed
@isaacs
isaacs deleted the isaacs/vercel-ai-telemetry-metadata branch October 6, 2026 07:13

This branch was successfully deployed

1 active deployment
Preview — 76d52b85 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to 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.

4 participants