Skip to content
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): Fix onError sampling when loading an expired buffered session #13962

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Oct 11, 2024

This fixes a bug where an older, saved session (that has a previousSessionId, i.e. session was recorded and expired) would cause buffered replays to not send when an error happens. This is because the session start timestamp would never update, causing our flush logic to skip sending the replay due to incorrect replay duration calculation.

…ssion

This fixes a bug where an older, saved session (that has a `previousSessionId`, i.e. session was recorded and expired) would cause buffered replays to not send when an error happens. This is because the session start timestamp would never update, causing our flush logic to skip sending the replay due to incorrect replay duration calculation.
Comment on lines -74 to -82
// If there is a previousSessionId after a full snapshot occurs, then
// the replay session was started due to session expiration. The new session
// is started before triggering a new checkout and contains the id
// of the previous session. Do not immediately flush in this case
// to avoid capturing only the checkout and instead the replay will
// be captured if they perform any follow-up actions.
if (session && session.previousSessionId) {
return true;
}
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 bug was so simple and right there this entire time 😭

Copy link

codecov bot commented Oct 11, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
631 1 630 30
View the top 1 failed tests by shortest run time
client-app-routing-instrumentation.test.ts Creates a navigation transaction for app router routes
Stack Traces | 30s run time
client-app-routing-instrumentation.test.ts:19:5 Creates a navigation transaction for app router routes

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@billyvg billyvg marked this pull request as ready for review October 11, 2024 19:27
@billyvg billyvg requested a review from a team as a code owner October 11, 2024 19:27
Copy link
Contributor

@c298lee c298lee left a comment

Choose a reason for hiding this comment

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

great catch!

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

OMG :O Great find!

@billyvg billyvg merged commit 5f68d4d into develop Oct 15, 2024
146 checks passed
@billyvg billyvg deleted the fix-replay-buffered-session-start-time-not-updating-loading-existing-session branch October 15, 2024 04:47
billyvg added a commit that referenced this pull request Oct 17, 2024
…ssion (#13962)

This fixes a bug where an older, saved session (that has a
`previousSessionId`, i.e. session was recorded and expired) would cause
buffered replays to not send when an error happens. This is because the
session start timestamp would never update, causing our flush logic to
skip sending the replay due to incorrect replay duration calculation.
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