Skip to content

feat(tracing-internal): Reset propagation context on navigation #11401

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

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Apr 3, 2024

This PR adds propagationContext resetting to our browserTracing navigation span handler. Whenever our browserTracingIntegrations (the default one or the framework/router-specific ones) start a navigation idle span (via startBrowserTracingNavigationSpan), we'll now set a new propagation context (i.e. new traceId and spanId) onto the scopes.

The consequence is that a trace will only be valid within a browser navigation. This is significantly shorter if users are using the SDK in an application with frequent (URL) route changes. For other types of applications (e.g. canvas-heavy web apps without classic routing), this won't change much from the status quo.

Added unit, integration and e2e tests to cover the change and demonstrate the expected behaviour.

closes #11377

Copy link
Contributor

github-actions bot commented Apr 3, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) 76.2 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay) 67.47 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) 71.3 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.03 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing) 32.13 KB (+0.1% 🔺)
@sentry/browser (incl. browserTracingIntegration) 32.13 KB (+0.1% 🔺)
@sentry/browser (incl. feedbackIntegration) 31.33 KB (0%)
@sentry/browser (incl. feedbackModalIntegration) 31.45 KB (0%)
@sentry/browser (incl. feedbackScreenshotIntegration) 31.45 KB (0%)
@sentry/browser (incl. sendFeedback) 27.42 KB (0%)
@sentry/browser 22.57 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 71.21 KB (+0.05% 🔺)
CDN Bundle (incl. Tracing, Replay) 65.94 KB (+0.05% 🔺)
CDN Bundle (incl. Tracing) 32.27 KB (+0.09% 🔺)
CDN Bundle 23.8 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 205.58 KB (+0.07% 🔺)
CDN Bundle (incl. Tracing) - uncompressed 96.23 KB (+0.15% 🔺)
CDN Bundle - uncompressed 70.24 KB (0%)
@sentry/react (incl. Tracing, Replay) 67.46 KB (+0.05% 🔺)
@sentry/react 22.6 KB (0%)

@Lms24 Lms24 self-assigned this Apr 3, 2024
@Lms24 Lms24 requested review from lforst, AbhiPrasad and s1gr1d April 3, 2024 15:03
@Lms24 Lms24 merged commit e9fd0db into develop Apr 3, 2024
@Lms24 Lms24 deleted the lms/ref-reset-propctx-navigation branch April 3, 2024 15:47
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this pull request Apr 19, 2024
…entry#11401)

Add propagationContext resetting to our `browserTracing`
navigation span handler. Whenever our `browserTracingIntegration`s (the
default one or the framework/router-specific ones) start a navigation
idle span (via `startBrowserTracingNavigationSpan`), we'll now set a new
propagation context (i.e. new traceId and spanId) onto the scopes.
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.

Reset PropagationContext on navigation
3 participants