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

♻️ [RUM-6813] Split the recorder API module #3181

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

amortemousque
Copy link
Contributor

@amortemousque amortemousque commented Nov 28, 2024

Motivation

The recorderApi module is a bit large and we want to add more logic before starting to lazy load the recorder. It is a good time to extract the "pre start" logic like we did with RUM and Logs: #2575.

Changes

  • Introduce a Strategy interface for behaviors that differs before and after starting the SDK.
  • Introduce a createPreStartStrategy to initialize the strategy before the SDK is started
  • Introduce a createPostStartStrategy to update the strategy after the SDK is started

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@amortemousque amortemousque requested a review from a team as a code owner November 28, 2024 08:22
@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 90.36145% with 8 lines in your changes missing coverage. Please review.

Project coverage is 93.41%. Comparing base (27f10a5) to head (e103093).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
packages/rum/src/boot/preStartStrategy.ts 68.75% 5 Missing ⚠️
packages/rum/src/boot/postStartStrategy.ts 96.00% 2 Missing ⚠️
packages/rum/src/boot/recorderApi.ts 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3181      +/-   ##
==========================================
- Coverage   93.46%   93.41%   -0.06%     
==========================================
  Files         280      282       +2     
  Lines        7698     7715      +17     
  Branches     1723     1728       +5     
==========================================
+ Hits         7195     7207      +12     
- Misses        503      508       +5     

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

Copy link

cit-pr-commenter bot commented Nov 29, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 161.96 KiB 162.21 KiB 260 B +0.16%
Logs 55.84 KiB 55.84 KiB 0 B 0.00%
Rum Slim 110.80 KiB 110.80 KiB 0 B 0.00%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.002 0.002 -0.001
addaction 0.062 0.043 -0.019
addtiming 0.001 0.001 -0.001
adderror 0.073 0.047 -0.026
startstopsessionreplayrecording 1.550 0.925 -0.625
startview 2.061 1.329 -0.732
logmessage 0.031 0.020 -0.011
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 7.54 KiB 8.55 KiB 1.01 KiB
addaction 40.10 KiB 39.73 KiB -373 B
addtiming 5.88 KiB 8.04 KiB 2.16 KiB
adderror 44.37 KiB 45.63 KiB 1.26 KiB
startstopsessionreplayrecording 3.75 KiB 5.50 KiB 1.75 KiB
startview 418.71 KiB 427.08 KiB 8.37 KiB
logmessage 40.26 KiB 41.10 KiB 860 B

🔗 RealWorld

Comment on lines 99 to 101
if (configuration.startSessionReplayRecordingManually) {
state.setStatus(RecorderStatus.Stopped)
}
Copy link
Member

Choose a reason for hiding this comment

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

💭 thought: ‏ ‏ ‏I know this is not from your PR, but this is really incorrect, because it discards any previous state, so in the scenario below, Session Replay won't start even though it is started manually:

DD_RUM.startSessionReplayRecording()
DD_RUM.init({ startSessionReplayRecordingManually: true })

packages/rum/src/boot/postStartStrategy.ts Outdated Show resolved Hide resolved
Extracted helper functions to check recorder status
@amortemousque
Copy link
Contributor Author

/to-staging

@dd-devflow
Copy link

dd-devflow bot commented Dec 5, 2024

Devflow running: /to-staging

View all feedbacks in Devflow UI.


2024-12-05 20:47:58 UTC ℹ️ Branch Integration: starting soon, median merge time is 9m49s

Commit e1030931e6 will soon be integrated into staging-49.


2024-12-05 20:59:48 UTC ℹ️ Branch Integration: This commit was successfully integrated

Commit e1030931e6 has been merged into staging-49 in merge commit 7d41db5ecd.

Check out the triggered pipeline on Gitlab 🦊

dd-mergequeue bot added a commit that referenced this pull request Dec 5, 2024
Integrated commit sha: e103093

Co-authored-by: Aymeric Mortemousque <[email protected]>
@dd-devflow dd-devflow bot added the staging-49 label Dec 5, 2024
@amortemousque amortemousque merged commit 17b3cbb into main Dec 6, 2024
21 checks passed
@amortemousque amortemousque deleted the aymeric/refactor-recorder-api branch December 6, 2024 09:54
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