Skip to content

feat(nextjs): Migrate sendDefaultPii to dataCollection#21137

Open
chargome wants to merge 3 commits into
developfrom
cg/next-datacollection
Open

feat(nextjs): Migrate sendDefaultPii to dataCollection#21137
chargome wants to merge 3 commits into
developfrom
cg/next-datacollection

Conversation

@chargome
Copy link
Copy Markdown
Member

@chargome chargome commented May 22, 2026

Migrate sendDefaultPii usage in the Next.js package to the dataCollection API:

  • withServerActionInstrumentation: Use getDataCollectionOptions().httpBodies.includes('outgoingResponse') to gate server action response recording
  • addHeadersAsAttributes: Use httpHeaders.request from getDataCollectionOptions() to control header span attributes and filtering level
  • setUrlProcessingMetadata: Remove the sendDefaultPii gate — URLs are fundamental request metadata, not PII-gated data (see spec update)
  • pagesRouterRoutingInstrumentation: Remove the sendDefaultPii gate for route params — same reasoning as URLs

ref getsentry/sentry-docs#17911

closes #20932

@chargome chargome self-assigned this May 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.17 kB - -
@sentry/browser - with treeshaking flags 25.62 kB - -
@sentry/browser (incl. Tracing) 45.25 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.47 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.22 kB - -
@sentry/browser (incl. Tracing, Replay) 84.83 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.39 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.53 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.15 kB - -
@sentry/browser (incl. Feedback) 44.34 kB - -
@sentry/browser (incl. sendFeedback) 31.98 kB - -
@sentry/browser (incl. FeedbackAsync) 37.08 kB - -
@sentry/browser (incl. Metrics) 28.25 kB - -
@sentry/browser (incl. Logs) 28.48 kB - -
@sentry/browser (incl. Metrics & Logs) 29.19 kB - -
@sentry/react 28.99 kB - -
@sentry/react (incl. Tracing) 47.51 kB - -
@sentry/vue 32.2 kB - -
@sentry/vue (incl. Tracing) 47.16 kB - -
@sentry/svelte 27.19 kB - -
CDN Bundle 29.55 kB - -
CDN Bundle (incl. Tracing) 47.81 kB - -
CDN Bundle (incl. Logs, Metrics) 31.05 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.04 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.31 kB - -
CDN Bundle (incl. Tracing, Replay) 85.18 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.35 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.05 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.21 kB - -
CDN Bundle - uncompressed 87.59 kB - -
CDN Bundle (incl. Tracing) - uncompressed 144.09 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 92.08 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.85 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 216.81 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.87 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.61 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.57 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.3 kB - -
@sentry/nextjs (client) 50.02 kB -0.04% -16 B 🔽
@sentry/sveltekit (client) 45.68 kB - -
@sentry/core/server 75.93 kB - -
@sentry/core/browser 63.09 kB - -
@sentry/node-core 61.69 kB - -
@sentry/node 130.4 kB - -
@sentry/node - without tracing 74.1 kB - -
@sentry/aws-serverless 86.29 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 171.5 kB - -
@sentry/cloudflare (withSentry) 429.29 kB - -

View base workflow run

@chargome
Copy link
Copy Markdown
Member Author

bugbot run

Comment thread packages/nextjs/src/common/utils/addHeadersAsAttributes.ts Outdated
const result = addHeadersAsAttributes({ 'content-type': 'application/json' });
expect(result).toEqual({});
});
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Feat PR lacks integration or E2E test coverage

Low Severity

This is a feat PR that migrates multiple code paths from sendDefaultPii to the dataCollection API, but the diff only includes unit tests (with heavy mocking). No integration or E2E test is present to validate the end-to-end behavior of these data-collection changes within an actual Next.js application. Per the review rules, feat PRs need at least one integration or E2E test. Flagging this because it was mentioned in the rules file.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 1ea8c62. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we got existing tests that cover this

@chargome chargome force-pushed the cg/next-datacollection branch from 1ea8c62 to 0d290e1 Compare May 29, 2026 10:45
@chargome
Copy link
Copy Markdown
Member Author

bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0d290e1. Configure here.

@chargome chargome marked this pull request as ready for review May 29, 2026 12:42
@chargome chargome requested a review from a team as a code owner May 29, 2026 12:42
@chargome chargome requested review from logaretm, nicohrubec and s1gr1d and removed request for a team May 29, 2026 12:42
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.

(nextjs): Migrate nextjs to dataCollection

1 participant