-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(replay): Log warning if trying to flush initial segment without checkout #8748
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
Conversation
…heckout We keep track of the eventBuffer contains a checkout, and if not, log a warning when trying to flush the initial segment. If this turns out to be happening, we may think about aborting flushing or similar in this case. But for now, we can gather data.
|
||
sessionStorage.clear(); | ||
clearSession(replay); | ||
replay['_loadAndCheckSession'](); | ||
// No-op _loadAndCheckSession to avoid us resetting the session for this test |
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.
actually noticed this test was incorrect before, it just worked because we never reset minReplayDuration
above 😬 oops...
size-limit report 📦
|
@@ -1151,6 +1151,12 @@ export class ReplayContainer implements ReplayContainerInterface { | |||
return; | |||
} | |||
|
|||
const eventBuffer = this.eventBuffer; | |||
if (eventBuffer && this.session.segmentId === 0 && !eventBuffer.hasCheckout) { |
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.
Hmm won't this log for session based replays?
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.
there should still always be a checkout in the initial segment, right?
* Log a message, and add a breadcrumb in the next tick. | ||
* This is necessary when the breadcrumb may be added before the replay is initialized. | ||
*/ | ||
export function logInfoNextTick(message: string, shouldAddBreadcrumb?: boolean): void { |
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.
I ended up splitting this into two methods logInfo
and logInfoNextTick
, as while the log in next tick
change fixed some cases, but "broke" others (when logging right before a flush). So now we only explicitly log in the next tick in cases that could be logged before the replay is started.
We keep track of the eventBuffer contains a checkout, and if not, log a warning when trying to flush the initial segment.
If this turns out to be happening, we may think about aborting flushing or similar in this case. But for now, we can gather data.