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: teardown and restart recording on session id change #1411

Merged
merged 9 commits into from
Sep 16, 2024

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Sep 10, 2024

sometimes we see the artificial full snapshot on session idle timeout end up in the previous session not the new session - no bueno

in an attempt to not keep adding conditionals here i want to explore if tearing down rrweb and restarting recording is more stable


locally this seems way more reliable, but I want to get #1416 in so I can retest without that noise

Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Sep 16, 2024 9:46am

Copy link

github-actions bot commented Sep 10, 2024

Size Change: +3.72 kB (+0.31%)

Total Size: 1.21 MB

Filename Size Change
dist/array.full.js 347 kB +931 B (+0.27%)
dist/array.js 163 kB +931 B (+0.57%)
dist/main.js 164 kB +931 B (+0.57%)
dist/module.js 163 kB +931 B (+0.57%)
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 10.4 kB
dist/recorder-v2.js 110 kB
dist/recorder.js 111 kB
dist/surveys-preview.js 59.8 kB
dist/surveys.js 66 kB
dist/tracing-headers.js 8.26 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

@pauldambra pauldambra changed the title teardown and restart recording on session id change fix: teardown and restart recording on session id change Sep 10, 2024
Copy link
Contributor

@daibhin daibhin left a comment

Choose a reason for hiding this comment

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

Looks like a simple enough change, happy to approve once you're ready for a full review

this._tryTakeFullSnapshot()
if (sessionIdChanged || windowIdChanged) {
this.stopRecording()
this.startIfEnabledOrStop()
Copy link
Contributor

Choose a reason for hiding this comment

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

Haven't looked into it but wondering if we need to consider anything here with regards to ingestion controls (sampling, feature flags, minimum duration) that might affect the new recording not starting

Copy link
Member Author

Choose a reason for hiding this comment

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

sampling and feature flags should just work...

min duration is interesting... i don't know if we'd restart the counter - we should... 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

yep... session start is read from storage, most recent snapshot data from the buffer, so we're safe with min duration too 👍

@@ -426,26 +427,6 @@ describe('SessionRecording', () => {
})
})

it('when the first event is an incremental it does take a manual full snapshot', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

not manually fangling this any more so we don't need to test it happens

$snapshot_data: [
createFullSnapshot(),
Copy link
Member Author

Choose a reason for hiding this comment

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

throughout these tests we're no longer manually adding full snapshots so we don't have to assert their presence

@pauldambra pauldambra added the bump patch Bump patch version when this PR gets merged label Sep 16, 2024
@pauldambra pauldambra merged commit c10acff into main Sep 16, 2024
13 checks passed
@pauldambra pauldambra deleted the fix/start-new-session-completely branch September 16, 2024 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants