-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: Refactor loading of snapshots #20632
Conversation
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
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.
long overdue improvement...
(doesn't actually playback for me at the moment 🙈 but it's still draft so 🚀)
frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
Show resolved
Hide resolved
frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
Show resolved
Hide resolved
frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts
Outdated
Show resolved
Hide resolved
frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts
Outdated
Show resolved
Hide resolved
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
Size Change: 0 B Total Size: 999 kB ℹ️ View Unchanged
|
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
@pauldambra great idea! I was actually holding off some work on our performance timing until this went through to see if it fixed the weird P99 issues. Happy to help out |
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
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.
Did a thorough review of this and
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.
@PostHog/team-product-analytics this snapshot seems to be flapping on quite a few PRs this week
frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts
Show resolved
Hide resolved
// TODO: Do a proper check for all sources having been loaded | ||
return ( |
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.
Could we check that the number of sources and the snapshots by source counts are the same e.g.
// TODO: Do a proper check for all sources having been loaded | |
return ( | |
// TODO: Do a proper check for all sources having been loaded | |
return ( | |
snapshotSources.length === Object.keys(snapshotsBySource).length |
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've shipped some smaller parts of this change in previous PRs and did a thorough review today. It's pretty difficult to review 100% but I'm fairly confident it does what it's intended to. My plan is to test it locally but think it's probably worth shipping at this point and following up with any fixes forward we need.
@benjackwhite is there anything you'd like to do before we ship? There's still a few TODOs knocking about
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 just don't have any spare capacity for it so its fully in your hands
]) | ||
}) | ||
|
||
it('can start polling for snapshots', async () => { | ||
it('polls up to a max threshold', async () => { |
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've just realised that the polling shouldn't trigger loading state in the logic - we don't want the loading affordances in the UI when we poll.
Totally separate to this, reading the code back made me realise
const params = { | ||
source: source.source, | ||
blob_key: source.blob_key, | ||
version: values.featureFlags[FEATURE_FLAGS.SESSION_REPLAY_V3_INGESTION_PLAYBACK] ? '3' : '2', |
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.
and I think we can delete all the v3 stuff since that experiment is over
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.
ran locally and I can load blob and realtime sources
Haven't seen any reports of this causing issues 🥳 Thanks for taking it on @benjackwhite |
Problem
This is a beefier refactor than I initially intended... but i think its worth it.
Primarily I needed to be able to control the parsing better so that v3 realtime snapshots would be loaded just like blob ones.
This led me down a bit of a rabbit hole in the logic where I realised it is pretty fragile and we could make much better use of separating out loaders and selectors
Changes
TODO
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?
Still need to update the tests