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

♻️✅ Harmonize record observers #2659

Merged
merged 6 commits into from
Mar 27, 2024

Conversation

amortemousque
Copy link
Collaborator

@amortemousque amortemousque commented Mar 19, 2024

Motivation

While implementing webview support for Session Replay, I identified inconsistencies in the recorder observers, plus some missing tests.

Changes

  • Harmonize record observers to always
  • Add tests for focusObserver, mediaInteractionObserver, scrollObserver, visualViewportResizeObserver
  • I moved the observers initialization up in record() and removed the initObservers() wrapper.

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@amortemousque amortemousque force-pushed the aymeric/refacto-replay-observers branch from e81ba6d to 5520199 Compare March 19, 2024 15:47
Copy link

cit-pr-commenter bot commented Mar 19, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 156.36 KiB 155.43 KiB -951 B -0.59%
Logs 55.34 KiB 55.34 KiB 0 B 0.00%
Rum Slim 101.93 KiB 101.93 KiB 0 B 0.00%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%

@amortemousque amortemousque marked this pull request as ready for review March 19, 2024 15:54
@amortemousque amortemousque requested a review from a team as a code owner March 19, 2024 15:54
@amortemousque
Copy link
Collaborator Author

/to-staging

@dd-devflow
Copy link
Contributor

dd-devflow bot commented Mar 19, 2024

🚂 Branch Integration: starting soon, merge in < 10m

Commit 552019963a will soon be integrated into staging-12.

This build is going to start soon! (estimated merge in less than 10m)

Use /to-staging -c to cancel this operation!

dd-mergequeue bot added a commit that referenced this pull request Mar 19, 2024
@dd-devflow
Copy link
Contributor

dd-devflow bot commented Mar 19, 2024

🚂 Branch Integration: This commit was successfully integrated

Commit 552019963a has been merged into staging-12 in merge commit 42b67d2819.

Check out the triggered pipeline on Gitlab 🦊

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 97.14286% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 93.33%. Comparing base (9bc31ce) to head (0206557).
Report is 5 commits behind head on main.

Files Patch % Lines
.../domain/record/observers/viewportResizeObserver.ts 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2659      +/-   ##
==========================================
+ Coverage   92.91%   93.33%   +0.42%     
==========================================
  Files         239      238       -1     
  Lines        6931     6904      -27     
  Branches     1517     1517              
==========================================
+ Hits         6440     6444       +4     
+ Misses        491      460      -31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amortemousque amortemousque force-pushed the aymeric/refacto-replay-observers branch from dd29d5c to f45226e Compare March 26, 2024 10:46
packages/rum/src/domain/record/record.ts Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ question: ‏any reason to have recordIds under trackers but not elementsScrollPositions for example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No it was already under "observers/" which I just renamed. Do you have an improvement in mind?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, since it is the only one not being named trackXXX, it stands out a bit.
Compared to the others, it does not track browser events or APIs but store an internal state.
Looking at elementsScrollPositions, it seems a bit similar.

So I am wondering if both should not be inside or outside trackers.

wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No strong opinion so let's put it outside to have do the minimal amount of change :)

@amortemousque amortemousque merged commit 281063c into main Mar 27, 2024
17 checks passed
@amortemousque amortemousque deleted the aymeric/refacto-replay-observers branch March 27, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants