Repository navigation
feat(core)!: Enable span streaming by default - #22642
Conversation
size-limit report 📦
|
2eeaff8 to
bf07f9b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bcca947. Configure here.
There was a problem hiding this comment.
I decided to migrate this test to span streaming since it specifically tests the Sentry.init-less loader setup. In this case, the default will be span streaming. The only way to opt-out of it would be to call Sentry.init in onload. Doing this in this test would defeat the purpose of the noOnload test scenario 😅
| "SENTRY_ENVIRONMENT": "qa", | ||
| "SENTRY_TRACES_SAMPLE_RATE": "1.0", | ||
| "SENTRY_TUNNEL": "http://localhost:3031/", | ||
| "SENTRY_TRACE_LIFECYCLE": "static", |
There was a problem hiding this comment.
The SDK for Astro 3-5 on cloudflare can only be configured via env variables (known issue, see docs). This makes opt-out less intuitive (but still possible). Astro 6 again pulls in the correct sentry.server.config.js file which lets users opt out via Sentry.init as usual.
There was a problem hiding this comment.
AWS Lambda layer is another case where the opt-out must happen via env variables, as long as users use the auto init. I think this is a fair tradeoff.
Default clients to the streamed trace lifecycle and automatically install
the required streaming integration in browser and server runtimes.
Explicit static lifecycle configuration remains supported.
Changes:
- `traceLifecycle` now defaults to `'stream'`
- `spanStreamingIntegration` is now added everywhere unless `traceLifecycle === 'static'`
- This adds a bundle size increase to the browser SDK (~2KB gzip), unavoidable as long as
transactions are still supported as an opt-out.
- removed the `beforeSetup` hook on `spanStreamingIntegration` in the browser SDK, since it
no longer needs to set the `traceLifecycle` option itself
- added support for the `SENTRY_TRACE_LIFECYCLE` env var to Node, Cloudflare, and Vercel Edge
to support opt-out for init-less SDK setups (AWS Lambda via `-i @sentry/aws-serverless/auto`,
Astro Cloudflare pages)
BREAKING CHANGE: Spans use the streamed trace lifecycle unless configured otherwise.
Fixes #22344
Co-Authored-By: Cursor <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
031faa7 to
9788d8a
Compare
| dsn: 'https://[email protected]/6690737', | ||
|
|
||
| tracesSampleRate: 1, | ||
| traceLifecycle: 'static', |
There was a problem hiding this comment.
decided to keep bundler plugins' trace lifecycle static as well. We can opt into streaming in a separate PR. This is an interesting case because traces in the plugin have higher chance of actually getting streamed due to the longer execution time.
Explicitly sets `'static'` trace lifecycle in more tests as prework for #22642. Mostly Deno and Bun tests this time but also some leftover unit tests. ref #22344 Co-authored-by: Cursor <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>

This PR makes
'stream'the default trace lifecycle, meaning span streaming is enabled by default.Changes:
traceLifecyclenow hasstreamas a default valuespanStreamingIntegrationis now added everywhere iftraceLifecycle === 'stream'.beforeSetuphookspanStreamingIntegrationin browser SDK, since it doesn't need to set thetraceLifecycleoption anymoreSENTRY_TRACE_LIFECYCLEenv vars to Node and Cloudflare to support opt-out for init-less SDK setups (AWS Lambda via the-i @sentry/aws-serverless/autosetup, Astro 3-5 Cloudflare pages)Fixes #22344