Skip to content

feat(core): Add client.setSessionTrackingEnabled() to toggle session tracking at runtime#22369

Draft
s1gr1d wants to merge 1 commit into
developfrom
sig/browser-sessions-toggle-enabled
Draft

feat(core): Add client.setSessionTrackingEnabled() to toggle session tracking at runtime#22369
s1gr1d wants to merge 1 commit into
developfrom
sig/browser-sessions-toggle-enabled

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Jul 17, 2026

Copy link
Copy Markdown
Member

Changing this new setting tracks whether session lifecycle callbacks (deferred send, user-change send, navigation) in the BrowserSession integration are allowed to fire.

Also adding 3 integration tests:

  • checking that sessions can be disabled and enabled again later
  • checking that no sessions are sent at all when being disabled right from the start
  • replays still work after disabling sessions

Closes #22261

@s1gr1d
s1gr1d requested a review from a team as a code owner July 17, 2026 15:00
@s1gr1d
s1gr1d requested review from logaretm and msonnb and removed request for a team July 17, 2026 15:00
@s1gr1d
s1gr1d force-pushed the sig/browser-sessions-toggle-enabled branch from b6a9b71 to e019b48 Compare July 17, 2026 15:01
@s1gr1d
s1gr1d requested a review from Lms24 July 17, 2026 15:01
@s1gr1d
s1gr1d marked this pull request as draft July 17, 2026 15:09
@github-actions

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.

Path Size % Change Change
@sentry/browser 27.82 kB +0.28% +76 B 🔺
@sentry/browser - with treeshaking flags 26.25 kB +0.27% +70 B 🔺
@sentry/browser (incl. Tracing) 46.64 kB +0.16% +72 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.45 kB +0.18% +83 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.43 kB +0.14% +71 B 🔺
@sentry/browser (incl. Tracing, Replay) 85.9 kB +0.1% +78 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.54 kB +0.1% +72 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 90.63 kB +0.09% +78 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.28 kB +0.08% +75 B 🔺
@sentry/browser (incl. Feedback) 45.01 kB +0.18% +80 B 🔺
@sentry/browser (incl. sendFeedback) 32.63 kB +0.25% +81 B 🔺
@sentry/browser (incl. FeedbackAsync) 37.77 kB +0.22% +80 B 🔺
@sentry/browser (incl. Metrics) 28.91 kB +0.26% +73 B 🔺
@sentry/browser (incl. Logs) 29.13 kB +0.28% +80 B 🔺
@sentry/browser (incl. Metrics & Logs) 29.84 kB +0.29% +86 B 🔺
@sentry/react 29.63 kB +0.29% +83 B 🔺
@sentry/react (incl. Tracing) 48.92 kB +0.16% +76 B 🔺
@sentry/vue 33.25 kB +0.25% +80 B 🔺
@sentry/vue (incl. Tracing) 48.58 kB +0.16% +74 B 🔺
@sentry/svelte 27.85 kB +0.28% +76 B 🔺
CDN Bundle 30.22 kB +0.27% +79 B 🔺
CDN Bundle (incl. Tracing) 48.61 kB +0.17% +81 B 🔺
CDN Bundle (incl. Logs, Metrics) 31.83 kB +0.29% +91 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.91 kB +0.16% +79 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 71.06 kB +0.13% +86 B 🔺
CDN Bundle (incl. Tracing, Replay) 86.12 kB +0.1% +80 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.43 kB +0.1% +84 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.93 kB +0.1% +90 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.2 kB +0.1% +87 B 🔺
CDN Bundle - uncompressed 90.08 kB +0.23% +205 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 146.93 kB +0.15% +208 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.79 kB +0.22% +205 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.91 kB +0.14% +208 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.53 kB +0.1% +205 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.15 kB +0.08% +208 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 270.11 kB +0.08% +208 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.85 kB +0.08% +208 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.8 kB +0.08% +208 B 🔺
@sentry/nextjs (client) 51.44 kB +0.15% +77 B 🔺
@sentry/sveltekit (client) 47.06 kB +0.17% +77 B 🔺
@sentry/core/server 78.71 kB +0.08% +61 B 🔺
@sentry/core/browser 65.13 kB +0.09% +58 B 🔺
@sentry/node-core 63.26 kB +0.08% +49 B 🔺
@sentry/node 125.61 kB +0.05% +58 B 🔺
@sentry/node (incl. diagnostics channel injection) 148.56 kB +0.04% +54 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB +0.01% +2 B 🔺
@sentry/node/light 51.37 kB +0.1% +48 B 🔺
@sentry/node - without tracing 74.76 kB +0.07% +52 B 🔺
@sentry/aws-serverless 84.02 kB +0.08% +62 B 🔺
@sentry/cloudflare (withSentry) - minified 184.24 kB +0.13% +238 B 🔺
⛔️ @sentry/cloudflare (withSentry) (max: 455.68 kB) 456.2 kB +0.18% +792 B 🔺

View base workflow run

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

LGTM! This addresses the user's report. I think the only issue is bumping the size limit and getting CI green.

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.

browserSessionIntegration has no way to suppress session capture for consent-gated setups (GDPR)

2 participants