Skip to content
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

feat(browser): Add browserSessionIntegration #14551

Merged
merged 7 commits into from
Dec 4, 2024

Conversation

lforst
Copy link
Member

@lforst lforst commented Dec 3, 2024

Ref: #14550

Adds a browserSessionIntegration that is exported from all browser SDKs which is added when autoSessionTracking: true, and entails the exact same functionality as autoSessionTracking does today.

In v9 this integration will become more fleshed out and completely replace autoSessionTracking in the browser SDKs.

Copy link

codecov bot commented Dec 3, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
537 1 536 151
View the top 1 failed tests by shortest run time
public-api/debug/test.ts logs debug messages correctly
Stack Traces | 0.178s run time
test.ts:7:11 logs debug messages correctly

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link
Contributor

github-actions bot commented Dec 3, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.17 KB +0.19% +44 B 🔺
@sentry/browser - with treeshaking flags 21.85 KB -0.01% -2 B 🔽
@sentry/browser (incl. Tracing) 35.66 KB +0.16% +58 B 🔺
@sentry/browser (incl. Tracing, Replay) 72.57 KB +0.13% +96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.99 KB +0.04% +24 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 76.88 KB +0.11% +82 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 89.36 KB +0.09% +78 B 🔺
@sentry/browser (incl. Feedback) 39.93 KB +0.13% +51 B 🔺
@sentry/browser (incl. sendFeedback) 27.78 KB +0.15% +41 B 🔺
@sentry/browser (incl. FeedbackAsync) 32.57 KB +0.07% +21 B 🔺
@sentry/react 25.84 KB +0.13% +34 B 🔺
@sentry/react (incl. Tracing) 38.47 KB -0.06% -20 B 🔽
@sentry/vue 27.37 KB +0.41% +112 B 🔺
@sentry/vue (incl. Tracing) 37.49 KB +0.27% +101 B 🔺
@sentry/svelte 23.33 KB +0.27% +64 B 🔺
CDN Bundle 24.33 KB +0.04% +8 B 🔺
CDN Bundle (incl. Tracing) 37.32 KB +0.05% +16 B 🔺
CDN Bundle (incl. Tracing, Replay) 72.19 KB +0.04% +24 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 77.53 KB +0.03% +21 B 🔺
CDN Bundle - uncompressed 71.5 KB +0.07% +51 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 110.78 KB +0.05% +51 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 223.85 KB +0.03% +51 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 237.07 KB +0.03% +51 B 🔺
@sentry/nextjs (client) 38.77 KB -0.05% -19 B 🔽
@sentry/sveltekit (client) 36.15 KB +0.03% +10 B 🔺
@sentry/node 134.83 KB +0.01% +1 B 🔺
@sentry/node - without tracing 96.84 KB +0.01% +1 B 🔺
@sentry/aws-serverless 109.17 KB -0.01% -1 B 🔽

View base workflow run

@lforst lforst marked this pull request as ready for review December 3, 2024 11:43
@lforst lforst requested a review from a team as a code owner December 3, 2024 11:43
// concept that can be used as a metric.
// Automatically captured sessions are akin to page views, and thus we
// discard their duration.
startSession({ ignoreDuration: true });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we adjust the startSession syntax to allow to optionally pass a client directly, and run all of this on setup(client) instead of setupOnce()? 🤔

Then again all of this is kind of global, so maybe this does not help anyhow 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same thoughts. I am actually extremely unsure on how to proceed. It all depends on how we would want sessions to work. If we want there to be multiple at once, it would make sense, however I would err towards the exact opposite.

I think always only having one session active per page makes the most sense. Even in MFEs. I would even go so far to lock down the API down even more in v9, simply because it makes wrapping your head around the concept easier.

All of this is just thinking out loud though. In general I didn't want this PR to be behaviorally significant. That's why I chose this route.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes sense to me!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, let's leave it at one "global" session per page.

@lforst lforst requested review from Lms24 and AbhiPrasad December 3, 2024 12:47
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -34,7 +34,7 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT
event_id: expect.stringMatching(/\w{32}/),
environment: 'production',
sdk: {
integrations: [
integrations: expect.arrayContaining([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: any reason to loosen the assertions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally found it to be very annoying that the ordering needed to be exact. Lmk if you want me to change it back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see, the ordering is annoying, agreed. Though these tests wouldn't fail additionally added integrations, unless I'm completely missing something. So that opens the test up to more behaviour change than previously. I don't think this is the end of the world but it'd be good to have at least one test that fails if we add a new integration by default. We should be aware of stuff like this.

@lforst lforst merged commit 7f36772 into develop Dec 4, 2024
149 checks passed
@lforst lforst deleted the lforst-expose-browser-session-integration branch December 4, 2024 15:16
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.

3 participants