Skip to content

[RUM Profiler] Use clocks for start/end time #3510

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

Merged
merged 6 commits into from
May 5, 2025

Conversation

thomasbertet
Copy link
Contributor

@thomasbertet thomasbertet commented Apr 30, 2025

Motivation

We are not using the exact same clocks when collecting long tasks (& LoAF) in both the Browser SDK and the RUM Profiler.
Let's have the RUM Profiler use the same clocks.

Changes

  • Relative time should now use RelativeTime types.
  • Make use of clocks helpers to get corrected relative and absolute time.
  • Save the drift for debugging purposes.

Test instructions

  • No behavior change expected. Only start/end time should be slightly updated, as they now take the drift into account.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 42.85714% with 12 lines in your changes missing coverage. Please review.

Project coverage is 92.20%. Comparing base (c2f6a22) to head (4bee450).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...rum/src/domain/profiling/utils/longTaskRegistry.ts 33.33% 8 Missing ⚠️
packages/rum/src/domain/profiling/profiler.ts 62.50% 3 Missing ⚠️
...es/rum/src/domain/profiling/transport/transport.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3510      +/-   ##
==========================================
- Coverage   92.20%   92.20%   -0.01%     
==========================================
  Files         312      312              
  Lines        8031     8030       -1     
  Branches     1814     1814              
==========================================
- Hits         7405     7404       -1     
  Misses        626      626              

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

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

start: start.toISOString(),
end: end.toISOString(),
start: new Date(profilerStartClocks.timeStamp).toISOString(),
end: new Date(profilerEndClocks.timeStamp).toISOString(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

🥜 nitpick: ‏we could extract specific type / helper for this format

Copy link

cit-pr-commenter bot commented Apr 30, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 145.11 KiB 145.11 KiB 0 B 0.00%
Rum Recorder 18.02 KiB 18.02 KiB 0 B 0.00%
Rum Profiler 4.64 KiB 4.73 KiB 97 B +2.04%
Logs 49.87 KiB 49.87 KiB 0 B 0.00%
Rum Slim 104.75 KiB 104.75 KiB 0 B 0.00%
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.002 0.003 0.000
addaction 0.042 0.042 0.001
addtiming 0.001 0.001 -0.000
adderror 0.045 0.043 -0.002
startstopsessionreplayrecording 0.007 0.013 0.006
startview 0.403 0.393 -0.011
logmessage 0.021 0.023 0.002
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 25.40 KiB 26.83 KiB 1.43 KiB
addaction 53.37 KiB 55.48 KiB 2.11 KiB
addtiming 25.25 KiB 25.20 KiB -47 B
adderror 58.21 KiB 58.03 KiB -177 B
startstopsessionreplayrecording 23.10 KiB 27.01 KiB 3.91 KiB
startview 424.76 KiB 429.25 KiB 4.49 KiB
logmessage 52.47 KiB 57.26 KiB 4.79 KiB

🔗 RealWorld

@thomasbertet
Copy link
Contributor Author

/to-staging

@dd-devflow
Copy link
Contributor

dd-devflow bot commented Apr 30, 2025

View all feedbacks in Devflow UI.

2025-04-30 11:55:24 UTC ℹ️ Start processing command /to-staging


2025-04-30 11:55:32 UTC ℹ️ Branch Integration: starting soon, merge expected in approximately 11m9s (p90)

Commit c0f9f9d524 will soon be integrated into staging-18.


2025-04-30 12:07:23 UTC ℹ️ Branch Integration: This commit was successfully integrated

Commit c0f9f9d524 has been merged into staging-18 in merge commit f1df86652b.

Check out the triggered pipeline on Gitlab 🦊

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

dd-mergequeue bot added a commit that referenced this pull request Apr 30, 2025
@thomasbertet thomasbertet marked this pull request as ready for review May 5, 2025 10:03
@thomasbertet thomasbertet requested a review from a team as a code owner May 5, 2025 10:03
@thomasbertet
Copy link
Contributor Author

@BenoitZugmeyer Thank you for the review!
I followed your advice and update the logic to use RelativeTime and have a nicer API for set/get the ids. Let me know if you'd like other things to change!

@thomasbertet thomasbertet merged commit f25d53b into main May 5, 2025
18 checks passed
@thomasbertet thomasbertet deleted the thomas.bertet/rum-profiler-use-clocks branch May 5, 2025 13:03
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.

4 participants