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 it right away (no harm in that, and arguably, that's the correct thing to do) but we call captureEnvelope 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.

Description
Our
browserSessionIntegrationsends a session envelope request directly insetupOnce(i.e. duringSentry.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 it right away (no harm in that, and arguably, that's the correct thing to do) but we call
captureEnvelopeeither viarequestIdleCallbackor via a ~5s timeout (TBD). Obviously, this should still happen "soon" after the pageload to avoid loosing out on short user sessions.