Skip to content

feat(node): Expand how vercel ai input/outputs can be set #16455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 5, 2025

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Jun 2, 2025

resolves #16452

Based on feedback, we want to enable attaching prompts (inputs/outputs) to vercel AI spans if sendDefaultPii is true.

We also add new integration options to the Vercel AI integration that allows you to override this.

export interface VercelAiOptions {
  /**
   * Enable or disable input recording. Enabled if `sendDefaultPii` is `true`
   * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings
   */
  recordInputs?: boolean;
  /**
   * Enable or disable output recording. Enabled if `sendDefaultPii` is `true`
   * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings
   */
  recordOutputs?: boolean;
}

Usage:

Sentry.vercelAIIntegration({ recordInputs: true });

@AbhiPrasad AbhiPrasad self-assigned this Jun 2, 2025
Copy link
Contributor

github-actions bot commented Jun 2, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.99 kB - -
@sentry/browser - with treeshaking flags 23.76 kB - -
@sentry/browser (incl. Tracing) 38.34 kB - -
@sentry/browser (incl. Tracing, Replay) 76.48 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.59 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 81.24 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 93.32 kB - -
@sentry/browser (incl. Feedback) 40.73 kB - -
@sentry/browser (incl. sendFeedback) 28.7 kB - -
@sentry/browser (incl. FeedbackAsync) 33.59 kB - -
@sentry/react 25.76 kB - -
@sentry/react (incl. Tracing) 40.33 kB - -
@sentry/vue 28.34 kB - -
@sentry/vue (incl. Tracing) 40.18 kB - -
@sentry/svelte 24.01 kB - -
CDN Bundle 25.48 kB - -
CDN Bundle (incl. Tracing) 38.52 kB - -
CDN Bundle (incl. Tracing, Replay) 74.38 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 79.8 kB - -
CDN Bundle - uncompressed 74.41 kB - -
CDN Bundle (incl. Tracing) - uncompressed 114.07 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 228.04 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 240.87 kB - -
@sentry/nextjs (client) 42 kB - -
@sentry/sveltekit (client) 38.84 kB - -
@sentry/node 150.28 kB +0.09% +135 B 🔺
@sentry/node - without tracing 98.34 kB +0.01% +1 B 🔺
@sentry/aws-serverless 124.1 kB +0.01% +1 B 🔺

View base workflow run

@AbhiPrasad AbhiPrasad requested review from a team, stephanie-anderson and s1gr1d and removed request for a team June 3, 2025 02:35
@AbhiPrasad AbhiPrasad marked this pull request as ready for review June 3, 2025 02:36
};
}
const client = getCurrentScope().getClient();
const shouldRecordImportAndExports = client?.getIntegrationByName(INTEGRATION_NAME)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: shouldn't this rather be named

Suggested change
const shouldRecordImportAndExports = client?.getIntegrationByName(INTEGRATION_NAME)
const shouldRecordInputsAndOutputs = client?.getIntegrationByName(INTEGRATION_NAME)

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done with 71e7546

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-l: Is there a reason for this file? No strong feelings, so feel free to disregard but I'd rather avoid a constants file with one export.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this here to avoid circular imports (instrumentation -> index)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh that's of course fine! sorry, didn't notice it

@AbhiPrasad AbhiPrasad force-pushed the abhi-send-default-pii-vercel-ai branch from e23162f to 71e7546 Compare June 3, 2025 16:22
@AbhiPrasad AbhiPrasad requested a review from Lms24 June 3, 2025 21:02
@AbhiPrasad AbhiPrasad changed the title feat(node): Add vercel ai input/outputs if sendDefaultPii is true feat(node): Expand how vercel ai input/outputs can be set Jun 5, 2025
@AbhiPrasad AbhiPrasad enabled auto-merge (squash) June 5, 2025 03:26
Copy link

codecov bot commented Jun 5, 2025

❌ Unsupported file format

Upload processing failed due to unsupported file format. Please review the parser error message:

Error parsing JUnit XML in /home/runner/work/sentry-javascript/sentry-javascript/packages/solidstart/vitest.junit.xml at 13:17

Caused by:
    RuntimeError: Error parsing XML
    
    Caused by:
        0: ill-formed document: expected `</testsuites>`, but `</testsuite>` was found
        1: expected `</testsuites>`, but `</testsuite>` was found

For more help, visit our troubleshooting guide.

@AbhiPrasad AbhiPrasad merged commit bfe5e88 into develop Jun 5, 2025
162 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-send-default-pii-vercel-ai branch June 5, 2025 03:41
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.

Record vercel ai inputs/outputs if sendDefaultPii is true.
2 participants