Skip to content

feat(replay): Do not capture replays < 5 seconds #7949

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 6 commits into from
May 16, 2023

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Apr 24, 2023

Do not immediately flush on snapshot checkouts, instead delay by minimum flush delay (5 seconds). This means that we will not collect replays < 5 seconds. e.g. User opens site and immediately closes the tab.

Semi-reverts #6463

Closes https://github.com/getsentry/team-replay/issues/63

@billyvg billyvg force-pushed the feat-replay-revert-immediate-flush-dom-checkout branch from 1b9048f to 7049268 Compare April 25, 2023 10:29
@github-actions
Copy link
Contributor

github-actions bot commented Apr 25, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 21.03 KB (+0.03% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 65.63 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.57 KB (+0.04% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 58.09 KB (+0.02% 🔺)
@sentry/browser - Webpack (gzipped + minified) 21.17 KB (0%)
@sentry/browser - Webpack (minified) 69.04 KB (0%)
@sentry/react - Webpack (gzipped + minified) 21.19 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 49.12 KB (+0.01% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 28.65 KB (+0.03% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.89 KB (+0.05% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 48.19 KB (+1.21% 🔺)
@sentry/replay - Webpack (gzipped + minified) 42.06 KB (+1.45% 🔺)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 67.15 KB (+0.98% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.05 KB (+1.13% 🔺)

@billyvg billyvg force-pushed the feat-replay-revert-immediate-flush-dom-checkout branch from 7049268 to 617e530 Compare May 1, 2023 13:33
@billyvg billyvg marked this pull request as ready for review May 5, 2023 00:28
@billyvg billyvg requested a review from mydea May 5, 2023 00:28
// a previous session ID. In this case, we want to buffer events
// for a set amount of time before flushing. This can help avoid
// capturing replays of users that immediately close the window.
setTimeout(() => replay.conditionalFlush(), options._experiments.delayFlushOnCheckout);
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this is worth the overhead, to have a separate initial flush timeout 🤔 If we "enforce" this to be === general flush debounce timeout, we could simply call debounced flush and call it a day? Then it would also ensure we do not flush twice etc. out of the box?

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 think it's fine for now since this is an experiment. We can think of bundling it up with the debounced flush when we GA this. The conditionalFlush here operates on the debounced flush anyway.

Copy link
Member

Choose a reason for hiding this comment

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

If we allowed the general debounce timeout to be user-controlled, chances are that they set it to something too high that would cause payloads to become too big?

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 don't think this is necessarily an option we expose at all - we just want to verify data integrity on Sentry before moving forward with a change.

@billyvg billyvg requested a review from Lms24 May 11, 2023 19:36
billyvg added 5 commits May 15, 2023 13:36
Do not immediately flush on snapshot checkouts, instead delay by minimum flush delay (5 seconds). This means that we will not collect replays < 5 seconds. e.g. User opens site and immediately closes the tab.

Closes getsentry/team-replay#63
@billyvg billyvg force-pushed the feat-replay-revert-immediate-flush-dom-checkout branch from c0cc254 to aab4786 Compare May 15, 2023 17:37
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.

I think it's worth revisiting this option before we promote it to the stable API but for now as an experiment, this LGTM!

@@ -285,6 +285,7 @@ export interface ReplayPluginOptions extends ReplayNetworkOptions {
scrollTimeout: number;
ignoreSelectors: string[];
};
delayFlushOnCheckout: number;
Copy link
Member

Choose a reason for hiding this comment

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

m: As long as we keep this an experiment, I'm fine with this name but if we make part of the public stable API, should we rename it to something less technical like initialFlushDelay?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, as stated in a diff comment, this may not be a public option, but if it is, we will rename it!

@billyvg billyvg merged commit 60a60ad into develop May 16, 2023
@billyvg billyvg deleted the feat-replay-revert-immediate-flush-dom-checkout branch May 16, 2023 18:48
billyvg added a commit that referenced this pull request Jun 1, 2023
Promotes the feature from #7949 to GA.

Do not immediately flush on snapshot checkouts, instead delay by minimum flush delay (5 seconds). This means that we will not collect replays < 5 seconds. e.g. User opens site and immediately closes the tab.

Closes getsentry/team-replay#65
billyvg added a commit that referenced this pull request Jun 2, 2023
Promotes the feature from #7949 to GA.

Do not immediately flush on snapshot checkouts, instead delay by minimum flush delay (5 seconds). This means that we will not collect replays < 5 seconds. e.g. User opens site and immediately closes the tab.

Closes getsentry/team-replay#65
billyvg added a commit that referenced this pull request Jun 6, 2023
Promotes the feature from #7949 to GA.

Do not immediately flush on snapshot checkouts, instead delay by minimum flush delay (5 seconds). This means that we will not collect replays < 5 seconds. e.g. User opens site and immediately closes the tab.

Closes getsentry/team-replay#65
billyvg added a commit that referenced this pull request Jun 8, 2023
Promotes the feature from #7949 to GA.

Do not immediately flush on snapshot checkouts, instead delay by minimum flush delay (5 seconds). This means that we will not collect replays < 5 seconds. e.g. User opens site and immediately closes the tab.

Closes getsentry/team-replay#65
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