Skip to content

feat(node): Update vercel ai integration attributes - #16721

Merged
AbhiPrasad merged 4 commits into
developfrom
abhi-vercel-ai-attribute-changes
Jul 2, 2025
Merged

feat(node): Update vercel ai integration attributes#16721
AbhiPrasad merged 4 commits into
developfrom
abhi-vercel-ai-attribute-changes

Conversation

@AbhiPrasad

Copy link
Copy Markdown
Contributor

Make changes to the Vercel AI integration as per https://www.notion.so/sentry/Agent-Monitoring-SDK-differences-21c8b10e4b5d80bcab51f72ae1418ea8

AI summary:

Key Improvements:

  1. Eliminated duplicate attributes - Tool call and prompt attributes are now renamed instead of duplicated
  2. Added tool input/output support - New gen_ai.tool.input and gen_ai.tool.output attributes
  3. Auto-sets tool type - Automatically adds gen_ai.tool.type: 'function' for tool calls
  4. Better OpenTelemetry compliance - Cleaner attribute mapping following semantic conventions

Technical Changes:

  • Uses renameAttributeKey() consistently instead of duplicating attributes
  • Removes old ai.* attributes after creating new gen_ai.* ones

@AbhiPrasad
AbhiPrasad requested review from a team and ArthurKnausJune 24, 2025 16:00
@AbhiPrasadAbhiPrasad self-assigned this Jun 24, 2025
@AbhiPrasad
AbhiPrasad requested review from Lms24 and chargome and removed request for a teamJune 24, 2025 16:00
@github-actions

github-actionsBot commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser23.99 kB--
@sentry/browser - with treeshaking flags23.76 kB--
@sentry/browser (incl. Tracing)39.59 kB--
@sentry/browser (incl. Tracing, Replay)77.69 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.78 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)82.45 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)94.57 kB--
@sentry/browser (incl. Feedback)40.75 kB--
@sentry/browser (incl. sendFeedback)28.7 kB--
@sentry/browser (incl. FeedbackAsync)33.59 kB--
@sentry/react25.76 kB--
@sentry/react (incl. Tracing)41.58 kB--
@sentry/vue28.37 kB--
@sentry/vue (incl. Tracing)41.4 kB--
@sentry/svelte24.01 kB--
CDN Bundle25.5 kB--
CDN Bundle (incl. Tracing)39.6 kB--
CDN Bundle (incl. Tracing, Replay)75.5 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)80.96 kB--
CDN Bundle - uncompressed74.5 kB--
CDN Bundle (incl. Tracing) - uncompressed117.63 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed231.68 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed244.5 kB--
@sentry/nextjs (client)43.22 kB--
@sentry/sveltekit (client)40.04 kB--
@sentry/node162.02 kB+0.04%+54 B 🔺
@sentry/node - without tracing98.64 kB-0.01%-1 B 🔽
@sentry/aws-serverless124.4 kB-0.01%-1 B 🔽

View base workflow run

@AbhiPrasad
AbhiPrasadforce-pushed the abhi-vercel-ai-attribute-changes branch from 55520e2 to e3cfd57CompareJune 24, 2025 19:31

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

🙌 thx for the quick changes!

@mydea

Copy link
Copy Markdown
Member

note: This may conflict with #16732, whatever we merge first needs to be adjusted accordingly!

@AbhiPrasad
AbhiPrasadforce-pushed the abhi-vercel-ai-attribute-changes branch from efdf029 to 6750b12CompareJuly 2, 2025 18:39
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

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

Bug: Span Attribute Modification Bug

The processToolCallSpan function incorrectly uses renameAttributeKey to modify a local attributes object, which is a snapshot of the span's data (from spanToJSON(span).data). This prevents the gen_ai.tool.name and gen_ai.tool.call.id attributes from being set on the actual span, unlike the previous direct span.setAttribute() calls. This also creates an inconsistency with other attributes correctly set on the span, and impacts the span's name update which relies on the gen_ai.tool.name attribute.

packages/core/src/utils/vercel-ai.ts#L118-L120

span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP,'gen_ai.execute_tool');
renameAttributeKey(attributes,AI_TOOL_CALL_NAME_ATTRIBUTE,'gen_ai.tool.name');
renameAttributeKey(attributes,AI_TOOL_CALL_ID_ATTRIBUTE,'gen_ai.tool.call.id');

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

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

@AbhiPrasad@mydea@ArthurKnaus