Skip to content

feat(browser): Add http.redirect_count attribute to browser.redirect span #15943

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Apr 2, 2025

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Apr 1, 2025

This PR adds an http.redirect_count attribute to browser.redirect spans. The count is taken from the navigation performance entry and it describes the number of times a redirect happened.

Two caveats:

  • we can't detect more about redirects (e.g. the location the browser was redirected to)
  • this only works for same-origin redirects. According to MDN, cross-origin redirects are not taken into account.

@Lms24 Lms24 changed the title feat(browser): Add redirectCount attribute feat(browser): Add redirectCount attribute to browser.redirect span Apr 1, 2025
@Lms24 Lms24 changed the title feat(browser): Add redirectCount attribute to browser.redirect span feat(browser): Add http.redirect_count attribute to browser.redirect span Apr 1, 2025
Copy link
Contributor

github-actions bot commented Apr 1, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.2 KB - -
@sentry/browser - with treeshaking flags 23.02 KB - -
@sentry/browser (incl. Tracing) 36.8 KB +0.11% +38 B 🔺
@sentry/browser (incl. Tracing, Replay) 73.95 KB +0.05% +31 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.35 KB +0.05% +29 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 78.62 KB +0.04% +32 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 91.19 KB +0.04% +30 B 🔺
@sentry/browser (incl. Feedback) 40.33 KB - -
@sentry/browser (incl. sendFeedback) 27.83 KB - -
@sentry/browser (incl. FeedbackAsync) 32.63 KB - -
@sentry/react 25 KB - -
@sentry/react (incl. Tracing) 38.72 KB +0.09% +35 B 🔺
@sentry/vue 27.41 KB - -
@sentry/vue (incl. Tracing) 38.51 KB +0.08% +31 B 🔺
@sentry/svelte 23.23 KB - -
CDN Bundle 24.44 KB - -
CDN Bundle (incl. Tracing) 36.82 KB +0.1% +36 B 🔺
CDN Bundle (incl. Tracing, Replay) 71.83 KB +0.05% +30 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 77.03 KB +0.06% +42 B 🔺
CDN Bundle - uncompressed 71.24 KB - -
CDN Bundle (incl. Tracing) - uncompressed 108.85 KB +0.08% +84 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 220.14 KB +0.04% +84 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 232.7 KB +0.04% +84 B 🔺
@sentry/nextjs (client) 40.02 KB +0.08% +29 B 🔺
@sentry/sveltekit (client) 37.23 KB +0.09% +32 B 🔺
@sentry/node 142.88 KB -0.01% -6 B 🔽
@sentry/node - without tracing 96.08 KB - -
@sentry/aws-serverless 120.43 KB - -

View base workflow run

@Lms24 Lms24 self-assigned this Apr 1, 2025
@Lms24 Lms24 requested review from lforst and s1gr1d April 1, 2025 13:13
@Lms24 Lms24 marked this pull request as ready for review April 1, 2025 13:13
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to only unit-test this because I couldn't find a way to easily simulate redirects in our playwright integration test setup. If reviewers prefer, I can add a redirection in an e2e test app where this might be easier.

@Lms24 Lms24 force-pushed the lms/feat-browser-redirect-count branch from 305e56b to 9e95bcd Compare April 2, 2025 10:39
@Lms24 Lms24 merged commit 3c1b3c9 into develop Apr 2, 2025
117 of 118 checks passed
@Lms24 Lms24 deleted the lms/feat-browser-redirect-count branch April 2, 2025 14:10
onurtemizkan pushed a commit that referenced this pull request Apr 3, 2025
…ct` span (#15943)

Adds an `http.redirect_count` attribute to `browser.redirect`
spans. The count is taken from the `navigation` performance entry and it
describes the number of times a redirect happened.

Two caveats:
- we can't detect more about redirects (e.g. the location the browser
was redirected to)
- this only works for same-origin redirects. [According to
MDN](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming/redirectCount#value),
cross-origin redirects are not taken into account.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants