sentry-javascript
sentry-javascript copied to clipboard
feat(core): Add `startNewTrace` API
This PR adds a new Sentry.startNewTrace function that allows users to start a trace in isolation of a potentially still active trace. When this function is called, a new trace will be started on a forked scope which remains valid throughout the callback lifetime.
Simple usage example:
myButton.addEventListener('click', async () => {
Sentry.startNewTrace(() => {
Sentry.startSpan({ op: 'ui.interaction.click', name: 'fetch click' }, async () => {
await fetch('http://example.com');
});
});
});
Extraced the generatePropagationContext utility to utils because it's used in multiple packages
size-limit report 📦
| Path | Size |
|---|---|
| @sentry/browser | 21.74 KB (+0.01% 🔺) |
| @sentry/browser (incl. Tracing) | 32.75 KB (-0.06% 🔽) |
| @sentry/browser (incl. Tracing, Replay) | 68.22 KB (-0.04% 🔽) |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags | 61.64 KB (-0.03% 🔽) |
| @sentry/browser (incl. Tracing, Replay with Canvas) | 72.27 KB (-0.03% 🔽) |
| @sentry/browser (incl. Tracing, Replay, Feedback) | 84.31 KB (-0.02% 🔽) |
| @sentry/browser (incl. Feedback) | 37.75 KB (-0.01% 🔽) |
| @sentry/browser (incl. sendFeedback) | 26.31 KB (-0.02% 🔽) |
| @sentry/browser (incl. FeedbackAsync) | 30.73 KB (-0.01% 🔽) |
| @sentry/react | 24.43 KB (+0.01% 🔺) |
| @sentry/react (incl. Tracing) | 35.75 KB (-0.06% 🔽) |
| @sentry/vue | 25.68 KB (-0.01% 🔽) |
| @sentry/vue (incl. Tracing) | 34.56 KB (-0.08% 🔽) |
| @sentry/svelte | 21.88 KB (+0.02% 🔺) |
| CDN Bundle | 24.28 KB (+0.01% 🔺) |
| CDN Bundle (incl. Tracing) | 34.22 KB (+0.01% 🔺) |
| CDN Bundle (incl. Tracing, Replay) | 68.04 KB (+0.02% 🔺) |
| CDN Bundle (incl. Tracing, Replay, Feedback) | 73.04 KB (+0.04% 🔺) |
| CDN Bundle - uncompressed | 71.46 KB (+0.01% 🔺) |
| CDN Bundle (incl. Tracing) - uncompressed | 101.58 KB (+0.04% 🔺) |
| CDN Bundle (incl. Tracing, Replay) - uncompressed | 211.48 KB (+0.02% 🔺) |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed | 223.84 KB (+0.02% 🔺) |
| @sentry/nextjs (client) | 35.1 KB (-0.04% 🔽) |
| @sentry/sveltekit (client) | 33.35 KB (-0.04% 🔽) |
| @sentry/node | 114.33 KB (+0.01% 🔺) |
| @sentry/aws-serverless | 103.2 KB (+0.01% 🔺) |