ref(replay): Log warning if trying to flush initial segment without checkout#8748
Merged
ref(replay): Log warning if trying to flush initial segment without checkout#8748
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.
mydea
commented
Aug 7, 2023
| sessionStorage.clear(); | ||
| clearSession(replay); | ||
| replay['_loadAndCheckSession'](); | ||
| // No-op _loadAndCheckSession to avoid us resetting the session for this test |
Member
Author
There was a problem hiding this comment.
actually noticed this test was incorrect before, it just worked because we never reset minReplayDuration above 😬 oops...
Contributor
size-limit report 📦
|
billyvg
approved these changes
Aug 7, 2023
billyvg
reviewed
Aug 7, 2023
| } | ||
|
|
||
| const eventBuffer = this.eventBuffer; | ||
| if (eventBuffer && this.session.segmentId === 0 && !eventBuffer.hasCheckout) { |
Member
There was a problem hiding this comment.
Hmm won't this log for session based replays?
Member
Author
There was a problem hiding this comment.
there should still always be a checkout in the initial segment, right?
mydea
commented
Aug 8, 2023
| * 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 { |
Member
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.