Skip to content

feat(nextjs): Migrate sendDefaultPii to dataCollection - #21137

Merged
chargome merged 3 commits into
developfrom
cg/next-datacollection
Jun 1, 2026
Merged

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

Conversation

@chargome

@chargomechargome commented May 22, 2026

Copy link
Copy Markdown
Member

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

@chargomechargome self-assigned this May 22, 2026
@github-actions

github-actionsBot commented May 22, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.17 kB--
@sentry/browser - with treeshaking flags25.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 flags74.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/react28.99 kB--
@sentry/react (incl. Tracing)47.51 kB--
@sentry/vue32.2 kB--
@sentry/vue (incl. Tracing)47.16 kB--
@sentry/svelte27.19 kB--
CDN Bundle29.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 - uncompressed87.59 kB--
CDN Bundle (incl. Tracing) - uncompressed144.09 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed92.08 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed147.85 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed216.81 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed262.87 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed266.61 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed276.57 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed280.3 kB--
@sentry/nextjs (client)50.02 kB-0.04%-16 B 🔽
@sentry/sveltekit (client)45.68 kB--
@sentry/core/server75.93 kB--
@sentry/core/browser63.09 kB--
@sentry/node-core61.69 kB--
@sentry/node130.4 kB--
@sentry/node - without tracing74.1 kB--
@sentry/aws-serverless86.29 kB+0.01%+1 B 🔺
@sentry/cloudflare (withSentry) - minified171.5 kB--
@sentry/cloudflare (withSentry)429.29 kB--

View base workflow run

@chargome

Copy link
Copy Markdown
MemberAuthor

bugbot run

Comment threadpackages/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 CursorFix 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
MemberAuthor

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
chargomeforce-pushed the cg/next-datacollection branch from 1ea8c62 to 0d290e1CompareMay 29, 2026 10:45
@chargome

Copy link
Copy Markdown
MemberAuthor

bugbot run

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

✅ 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 ownerMay 29, 2026 12:42
@chargome
chargome requested review from logaretm, nicohrubec and s1gr1d and removed request for a teamMay 29, 2026 12:42
@chargome
chargome merged commit f1b3a7e into developJun 1, 2026
79 checks passed
@chargome
chargome deleted the cg/next-datacollection branch June 1, 2026 12:11
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.

(nextjs): Migrate nextjs to dataCollection

2 participants

@chargome@s1gr1d