Skip to content

ref(replay): Handle checkouts more explicitly #7321

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

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Mar 2, 2023

We used to look at event.type === 2 for replay events to infer if something is a checkout or not.
This is a bit hacky, as type === 2 actually just means it is a full snapshot, which may or may not be due to a checkout.
This makes it hard/impossible to do any future changes where we may want to do a full snapshot in other scenarios than in error mode, e.g. if we want to do a full snapshot to avoid large mutations.

This PR refactors this a bit to really just look at isCheckout, plus also handle the very first rrweb event as a checkout (because we rely on this a bit).

This replaces #7237

@mydea mydea added the Package: replay Issues related to the Sentry Replay SDK label Mar 2, 2023
@mydea mydea requested review from billyvg and Lms24 March 2, 2023 14:30
@mydea mydea self-assigned this Mar 2, 2023
@@ -40,5 +29,16 @@
"id": 15,
"x": 157,
"y": 90
},
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 have no idea why this is suddenly ordered differently... It seems to be consistently so now. Not sure @cmanallen / @billyvg if you know, does this make any difference, or is the order of records in this incremental snapshot array not important? I don't really see timestamps here, but not sure...

Copy link
Member

Choose a reason for hiding this comment

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

Hmm not sure, also interesting it doesn't have a type either

"rel": "icon",
"type": "image/png",
"href": "file://assets/icon/favicon.png"
"rr_width": "[0-50]px",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is unrelated but wasn't updated and fails locally.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.12 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 62.55 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.76 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 55.53 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.5 KB (0%)
@sentry/browser - Webpack (minified) 66.99 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.53 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.2 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.2 KB (+0.01% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.46 KB (+0.01% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.12 KB (+0.14% 🔺)
@sentry/replay - Webpack (gzipped + minified) 37.15 KB (+0.14% 🔺)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.86 KB (+0.1% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 54.24 KB (+0.11% 🔺)

@mydea mydea force-pushed the fn/replay-handle-checkout branch from 4bbec5d to ee92a14 Compare March 3, 2023 08:58
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.

LGTM - also thanks for extracting out the function (I think we can take the slight bundle size hit over readability/maintainability)

@@ -45,21 +45,31 @@ sentryTest(

const reqPromise0 = waitForReplayRequest(page, 0);
const reqPromise1 = waitForReplayRequest(page, 1);
const reqPromise2 = waitForReplayRequest(page, 2);
Copy link
Member

Choose a reason for hiding this comment

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

(no action required)
Good change, let's just always keep these at the top of tests for consistency going forward

Copy link
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

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

Makes sense to me, I think the missing isCheckout on the initial payload is why I had originally used the FullSnapshot type.

@@ -40,5 +29,16 @@
"id": 15,
"x": 157,
"y": 90
},
Copy link
Member

Choose a reason for hiding this comment

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

Hmm not sure, also interesting it doesn't have a type either

@mydea mydea force-pushed the fn/replay-handle-checkout branch 3 times, most recently from c6a8c24 to cdb2b17 Compare March 7, 2023 12:15
@mydea mydea force-pushed the fn/replay-handle-checkout branch from cdb2b17 to c6cef1b Compare March 7, 2023 14:29
@mydea mydea merged commit 14b6fca into develop Mar 7, 2023
@mydea mydea deleted the fn/replay-handle-checkout branch March 7, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: replay Issues related to the Sentry Replay SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants