designcourse icon indicating copy to clipboard operation
designcourse copied to clipboard

♻️ [RUM-9126] Decouple common contexts from rumPublicApi

Open amortemousque opened this issue 8 months ago • 2 comments

Motivation

"Decouple the common context from rumPublicApi. The common contexts (user, account, global) are currently tied to rumPublicApi to ensure that saving and retrieving context work before initialization.

To prevent any breaking changes, this PR:

  • Buffers the context API calls to ensure saving context before initialization works
  • Maintains a 'fake' context in the pre-init logic so that DD_RUM.getGlobalContext() also works

(Review per commit)

Changes

  • Create dedicated module for account, user and global context.
  • Replace common context in rumPublicApi.
  • Remove savedCommonContext in collections and assembly

Testing

  • [x] Local
  • [x] Staging
  • [x] Unit
  • [ ] End to end

I have gone over the contributing documentation.

amortemousque avatar Mar 18 '25 10:03 amortemousque

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 91.94%. Comparing base (654e38a) to head (560a7b2). :warning: Report is 243 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3432      +/-   ##
==========================================
+ Coverage   91.91%   91.94%   +0.02%     
==========================================
  Files         309      312       +3     
  Lines        8105     8122      +17     
  Branches     1838     1837       -1     
==========================================
+ Hits         7450     7468      +18     
+ Misses        655      654       -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Mar 18 '25 10:03 codecov-commenter

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 146.96 KiB 147.41 KiB 462 B +0.31%
Logs 51.38 KiB 51.38 KiB 0 B 0.00%
Rum Slim 106.19 KiB 106.77 KiB 600 B +0.55%
Worker 23.59 KiB 23.59 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.003 0.003 -0.000
addaction 0.038 0.037 -0.001
addtiming 0.001 0.001 -0.000
adderror 0.041 0.041 0.000
startstopsessionreplayrecording 0.009 0.017 0.009
startview 0.421 0.398 -0.022
logmessage 0.021 0.024 0.003
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 27.69 KiB 28.45 KiB 777 B
addaction 54.53 KiB 52.64 KiB -1928 B
addtiming 26.25 KiB 25.99 KiB -260 B
adderror 58.81 KiB 57.70 KiB -1130 B
startstopsessionreplayrecording 25.45 KiB 24.76 KiB -703 B
startview 425.99 KiB 424.28 KiB -1748 B
logmessage 54.87 KiB 59.56 KiB 4.69 KiB

🔗 RealWorld

cit-pr-commenter[bot] avatar Mar 18 '25 10:03 cit-pr-commenter[bot]

/to-staging

amortemousque avatar Apr 01 '25 09:04 amortemousque

View all feedbacks in Devflow UI. 2025-04-01 09:12:49 UTC :information_source: Start processing command /to-staging


2025-04-01 09:12:57 UTC :information_source: Branch Integration: starting soon, merge expected in approximately 15m44s (p90)

Commit 560a7b27e9 will soon be integrated into staging-14.


2025-04-01 09:25:43 UTC :information_source: Branch Integration: This commit was successfully integrated

Commit 560a7b27e9 has been merged into staging-14 in merge commit d00f3501f7.

Check out the triggered pipeline on Gitlab :fox_face:

If you need to revert this integration, you can use the following command: /code revert-integration -b staging-14

dd-devflow[bot] avatar Apr 01 '25 09:04 dd-devflow[bot]