Skip to content

Browser Session envelope is sent directly at SDK init time, causing SDK overhead increases #21817

Description

@Lms24

Description

Our browserSessionIntegration sends a session envelope request directly in setupOnce (i.e. during Sentry.init()). While the SDK does not block init on the request, it invokes the processing and sending pipeline. This adds overhead. Moreover, a request leaving the web app this early has influence on the browser's network. We could demonstrate this in our Lighthouse performance tests, where we observed that especially under Ligththouse Lantern test mode, the additional request drastically increases the test app's LCP and decreases LH performance scores.

We can quite easily defer sending the session envelope. We still start the session right away (no harm in that, and arguably, that's the correct thing to do) but we call captureSession either via requestIdleCallback or via a ~5s timeout (TBD). Obviously, this should still happen "soon" after the pageload to avoid loosing out on short user sessions.

Image

Metadata

Metadata

Assignees

Labels

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions