Skip to content

fix(browser): Improve navigation vs. redirect detection #17275

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jul 31, 2025

This PR attempts to improve our navigation root vs. navigation.redirect child span detection logic in the default browserTracingIntegration:

  • Increase the threshold of inactivity between potential navigations from 300ms to 1.5s
  • Change how we treat interactions:
    • Previously, we'd take interactions happening before the last root span was started into account
    • Now, we reset the interaction timestamp when we start a new navigation root span. So from that moment on, we'll consider every new navigation span a redirect iff:
      • no interaction happened within 1.5s (from root span start)
      • the new span was started within 1.5s
      • there is still an active root span

I was a bit confused about the previous logic of interaction timestamps, including the tests. So in attempt to clear it up, I also renamed and slightly reworked the tests. Also added a couple of new ones, including one that tests a series of redirects and navigations. Chances are though, that I'm missing an important detail why we reused interaction timestamps prior to the last root span.

First part of #17282. From this issue, we should still consider bringing this functionality to all BT integrations but one step at a time :)

@Lms24 Lms24 force-pushed the lms/fix-browser-redirect-threshold branch from a862c31 to 1dbc1af Compare July 31, 2025 15:38
@Lms24 Lms24 changed the title fix(browser): Increase navigation span redirect time threshold fix(browser): Improve navigation vs. redirect detection Aug 1, 2025
@Lms24 Lms24 requested review from mydea and edwardgou-sentry August 1, 2025 11:51
@Lms24 Lms24 self-assigned this Aug 1, 2025
Copy link
Contributor

github-actions bot commented Aug 1, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.76 kB - -
@sentry/browser - with treeshaking flags 22.35 kB - -
@sentry/browser (incl. Tracing) 39.44 kB +0.02% +4 B 🔺
@sentry/browser (incl. Tracing, Replay) 77.52 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.39 kB +0.01% +4 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 82.22 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 94.36 kB +0.01% +4 B 🔺
@sentry/browser (incl. Feedback) 40.45 kB - -
@sentry/browser (incl. sendFeedback) 28.45 kB - -
@sentry/browser (incl. FeedbackAsync) 33.34 kB - -
@sentry/react 25.5 kB - -
@sentry/react (incl. Tracing) 41.41 kB +0.02% +5 B 🔺
@sentry/vue 28.2 kB - -
@sentry/vue (incl. Tracing) 41.24 kB +0.01% +4 B 🔺
@sentry/svelte 23.79 kB - -
CDN Bundle 25.28 kB - -
CDN Bundle (incl. Tracing) 39.31 kB +0.02% +6 B 🔺
CDN Bundle (incl. Tracing, Replay) 75.39 kB +0.01% +5 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 80.82 kB +0.01% +6 B 🔺
CDN Bundle - uncompressed 73.86 kB - -
CDN Bundle (incl. Tracing) - uncompressed 116.36 kB +0.01% +11 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 230.57 kB +0.01% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 243.38 kB +0.01% +11 B 🔺
@sentry/nextjs (client) 43.46 kB +0.02% +5 B 🔺
@sentry/sveltekit (client) 39.87 kB +0.02% +5 B 🔺
@sentry/node-core 47.53 kB +0.01% +1 B 🔺
@sentry/node 146.19 kB +0.01% +1 B 🔺
@sentry/node - without tracing 91.63 kB +0.01% +1 B 🔺
@sentry/aws-serverless 103.08 kB - -

View base workflow run

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.

1 participant