-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(replay): Ignore older performance entries when starting manually #13969
Conversation
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!
// We leave 1s wiggle room to accomodate timing differences for "immedidate" manual starts | ||
const initialTimestampInSeconds = this._context.initialTimestamp / 1000 - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want the wiggle room? Since it's manual start, I think it's ok to only capture events after start. It's easier to explain to users as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is that if you have code like this, I guess:
Sentry.init({
replaysErrorSampleRate: 0,
replaysSessionSampleRate: 0,
integrations: [replay]
});
if (isImportantUser) {
replay.start();
}
Like this kind of pattern, where users start manually but "immediately", we would otherwise probably miss many of the page load performance entries, as they are often correctly pre-dated to Date.now()
🤔 but no strong feelings, it is a bit "random". happy to generally remove the wiggle room!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah didn't consider that... I think we keep it simple and remove the wiggle room, but don't feel strongly about this.
5ee3f10
to
e861f46
Compare
I removed the wiggle room, I left in the test that shows the current behavior for immediate start as well :) |
For replay, performance entries are captured separately, and added to the replay before we send it.
Generally, this works just fine, because when we buffer, we clear the captured performance events whenever the buffer is cleared.
However, when we manually start the replay, it can happen that we capture performane entries from way before we started the replay manually, which will in turn extend the timeline of the replay potentially drastically.
To fix this, we now drop any performance events, when starting manually, that happened more than a second before we manually started the replay.
The 1s is an arbitrary number to accomodate the fact that some entries can be emitted slightly before - when we immediately run
replay.start()
we generally want to try to keep those too.