Skip to content

feat(browser): Migrate sendDefaultPii to dataCollection in browser packages - #21097

Merged
chargome merged 6 commits into
developfrom
cg/data-collection-browser
May 28, 2026
Merged

feat(browser): Migrate sendDefaultPii to dataCollection in browser packages#21097
chargome merged 6 commits into
developfrom
cg/data-collection-browser

Conversation

@chargome

Copy link
Copy Markdown
Member
  • browser/src/client.ts: Migrate to dataCollection for infer_ip relay setting and addAutoIpAddressToSession listener
  • browser/src/integrations/httpclient.ts: Split single sendDefaultPii gate into granular cookies, httpHeaders.request, httpHeaders.response checks with new collect behavior filtering. Includes a backwards-compat guard so legacy sendDefaultPii users see no behavioral change (deferred to v11).
  • browser-utils/src/metrics/utils.ts: Migrate to dataCollection for client.address span attribute

Note on backwards compatibility:

When dataCollection is not explicitly set by the user, the httpclient integration falls back to the old sendDefaultPii boolean gate (all-or-nothing). This avoids silently sending more data for existing users. When dataCollection is explicitly set, the granular filtering is applied. (#21094)

closes#20929

@chargomechargome self-assigned this May 21, 2026
@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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit eb71e9e. Configure here.

Comment threadpackages/browser/src/integrations/httpclient.ts
@github-actions

github-actionsBot commented May 21, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser27.17 kB+0.04%+9 B 🔺
@sentry/browser - with treeshaking flags25.62 kB+0.03%+6 B 🔺
@sentry/browser (incl. Tracing)45.25 kB+0.02%+8 B 🔺
@sentry/browser (incl. Tracing + Span Streaming)47.47 kB+0.02%+6 B 🔺
@sentry/browser (incl. Tracing, Profiling)50.22 kB+0.01%+5 B 🔺
@sentry/browser (incl. Tracing, Replay)84.83 kB+0.01%+7 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags74.39 kB+0.01%+4 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)89.53 kB+0.01%+8 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)102.15 kB+0.01%+4 B 🔺
@sentry/browser (incl. Feedback)44.34 kB+0.03%+10 B 🔺
@sentry/browser (incl. sendFeedback)31.98 kB+0.03%+7 B 🔺
@sentry/browser (incl. FeedbackAsync)37.08 kB+0.03%+8 B 🔺
@sentry/browser (incl. Metrics)28.25 kB+0.04%+11 B 🔺
@sentry/browser (incl. Logs)28.48 kB+0.04%+9 B 🔺
@sentry/browser (incl. Metrics & Logs)29.19 kB+0.04%+10 B 🔺
@sentry/react28.99 kB+0.04%+9 B 🔺
@sentry/react (incl. Tracing)47.51 kB+0.02%+5 B 🔺
@sentry/vue32.21 kB+0.02%+4 B 🔺
@sentry/vue (incl. Tracing)47.16 kB+0.03%+10 B 🔺
@sentry/svelte27.19 kB+0.04%+10 B 🔺
CDN Bundle29.55 kB+0.04%+10 B 🔺
CDN Bundle (incl. Tracing)47.81 kB+0.02%+7 B 🔺
CDN Bundle (incl. Logs, Metrics)31.05 kB+0.03%+9 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics)49.04 kB+0.02%+6 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics)70.31 kB+0.02%+8 B 🔺
CDN Bundle (incl. Tracing, Replay)85.18 kB+0.01%+5 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)86.35 kB+0.01%+5 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)91.05 kB-0.01%-2 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)92.21 kB-0.01%-4 B 🔽
CDN Bundle - uncompressed87.59 kB+0.03%+18 B 🔺
CDN Bundle (incl. Tracing) - uncompressed144.09 kB+0.02%+18 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed92.08 kB+0.02%+18 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed147.85 kB+0.02%+18 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed216.81 kB+0.01%+18 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed262.87 kB+0.01%+18 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed266.61 kB+0.01%+18 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed276.57 kB+0.01%+18 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed280.3 kB+0.01%+18 B 🔺
@sentry/nextjs (client)50.03 kB+0.03%+13 B 🔺
@sentry/sveltekit (client)45.68 kB+0.03%+10 B 🔺
@sentry/core/server75.93 kB--
@sentry/core/browser63.09 kB--
@sentry/node-core61.96 kB--
@sentry/node130.39 kB--
@sentry/node - without tracing74.36 kB--
@sentry/aws-serverless86.57 kB+0.01%+2 B 🔺
@sentry/cloudflare (withSentry) - minified171.5 kB--
@sentry/cloudflare (withSentry)429.29 kB--

View base workflow run

@chargome
chargome marked this pull request as ready for review May 21, 2026 13:19
@chargome
chargome requested a review from a team as a code ownerMay 21, 2026 13:20
@chargome
chargome requested review from logaretm and mydea and removed request for a teamMay 21, 2026 13:20

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

Maybe we should add tests to lock down the new sensitive header filtering behavior

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

Looks good, also read the comment from the AI review, but I would consider that a fix (see comment above).

@chargome

Copy link
Copy Markdown
MemberAuthor

added the tests @logaretm

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.

(browser): Migrate browser + browser-utils to dataCollection

3 participants

@chargome@logaretm@s1gr1d