feat(replay): Filter out style mutations when extracting DOM nodes#83016
Merged
feat(replay): Filter out style mutations when extracting DOM nodes#83016
style mutations when extracting DOM nodes#83016Conversation
We have an org that has a small handful of replays where the replayStepper causes massive perf issues to the extent that it freezes the browser. I narrowed it down to the `diff()` code inside of `rrdom` and a recent upstream PR (getsentry/rrweb#233) seems to have exacerbated the problem. I have not been able to figure out the root cause for the perf issues, but it seems to be related to CSS and the mutations that add `style` elements. We will want to try to identify what exactly in these replays are causing the perf issues. In the meantime we can filter out these mutations. Since we are only interested in generating and extracting the HTML for certain breadcrumb events, the styles should have no affect on the data we are interested in using. Closes #82221
ryan953
reviewed
Jan 7, 2025
Comment on lines
+548
to
+550
| e.type === EventType.IncrementalSnapshot && | ||
| 'source' in e.data && | ||
| e.data.source === IncrementalSource.Mutation |
Member
There was a problem hiding this comment.
i had this same bug! forgetting about FullSnapshot.
there's a new util to help:
import {isRRWebChangeFrame} from 'sentry/utils/replays/types';
in the other places where I've called the util i did not memoize it... because i was lazy and didn't add to ReplayReader; just chained some calls. That could probably be unified.
Member
Author
There was a problem hiding this comment.
In this case, we don't care about full snapshots, only incremental
Member
Author
There was a problem hiding this comment.
(I did copy&paste this from elsewhere though, so would be good to refactor into a helper)
ryan953
approved these changes
Jan 7, 2025
c298lee
approved these changes
Jan 7, 2025
andrewshie-sentry
pushed a commit
that referenced
this pull request
Jan 22, 2025
…83016) We have an org that has a small handful of replays where the replayStepper causes massive perf issues to the extent that it freezes the browser. I narrowed it down to the `diff()` code inside of `rrdom` and a recent upstream PR (getsentry/rrweb#233) seems to have exacerbated the problem. I have not been able to figure out the root cause for the perf issues, but it seems to be related to CSS and the mutations that add `style` elements. We will want to try to identify what exactly in these replays are causing the perf issues. In the meantime we can filter out these mutations. Since we are only interested in generating and extracting the HTML for certain breadcrumb events, the styles should have no affect on the data we are interested in using. Closes #82221
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 have an org that has a small handful of replays where the replayStepper
causes massive perf issues to the extent that it freezes the browser. I
narrowed it down to the
diff()code inside ofrrdomand a recent upstreamPR (getsentry/rrweb#233) seems to have exacerbated the
problem. I have not been able to figure out the root cause for the perf issues,
but it seems to be related to CSS and the mutations that add
styleelements.We will want to try to identify what exactly in these replays are causing the
perf issues.
In the meantime we can filter out these mutations. Since we are only interested
in generating and extracting the HTML for certain breadcrumb events, the styles
should have no affect on the data we are interested in using.
Closes #82221