-
Notifications
You must be signed in to change notification settings - Fork 156
✨ [RUM-10144] apply context defined just after init to View event generated during init #3597
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
base: main
Are you sure you want to change the base?
Conversation
d511589
to
e28ba32
Compare
e28ba32
to
2b6121e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3597 +/- ##
==========================================
+ Coverage 92.37% 92.39% +0.01%
==========================================
Files 323 323
Lines 8135 8148 +13
Branches 1841 1842 +1
==========================================
+ Hits 7515 7528 +13
Misses 620 620 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
/to-staging |
View all feedbacks in Devflow UI.
Commit 2b6121e26e will soon be integrated into staging-23.
Commit 2b6121e26e has been merged into staging-23 in merge commit 6826f9d5e7. Check out the triggered pipeline on Gitlab 🦊 If you need to revert this integration, you can use the following command: |
Integrated commit sha: 2b6121e Co-authored-by: BenoitZugmeyer <[email protected]>
Motivation
Usually, context (global/user/account/feature flags etc.) is defined just after calling
RUM.init()
, which is an issue because events that are generated duringinit()
will not have this context.This is only problematic for View events: RUM.init() generates a first View event that is missing the context defined right after. It is usually fine, as we can expect a RUM View Update to be generated at some point later. But sometimes no View Update happen for some reason (connectivity error, browser exiting abruptly...). In those cases, it is unexpected that the View isn't including the context.
Changes
This PR fixes this issue by slightly delaying the first View update. It uses
Promise.resolve()
to schedule a view update in the next micro task. It should not impact reliability as usingPromise.resolve().then()
to schedule a micro task is not impacted by timers throttling.Please review commit by commit.
Test instructions
In the sandbox, define a user just after
init()
:Using the devtools extension, look at individual View events by unchecking
Show only the latest View event
in the "Events" tab.When loading the sandbox URL, all View events should contain the
@usr.id
, even the very first View.Checklist