- Notifications
You must be signed in to change notification settings - Fork 147
feat(rum-core): end spa navigations after browser frame #730
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
feat(rum-core): end spa navigations after browser frame #730
Conversation
Codecov Report
@@ Coverage Diff @@ ## master #730 +/- ## ========================================== - Coverage 94.21% 93.71% -0.51% ========================================== Files 48 49 +1 Lines 2162 2194 +32 Branches 427 437 +10 ========================================== + Hits 2037 2056 +19 - Misses 122 135 +13 Partials 3 3
|
| Had a meeting:
|
| jenkins run the tests please |
hmdhk left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vigneshshanmugam , Would you please comment about the Chrome 76 scheduling issue here? Let's dig into more detail to see if there's an underlying issue with this approach instead of bumping the chrome version.
Its not chrome 76 scheduling issue (sorry for the noise), I added more details with comments in the test itself. It's hard to know test this scenario for different browsers, thats why the test checks for 2 or 3 more, Also its not a common scenario - No one of the frameworks that I have tested(React, Vue, Angular, Preact) use this double timeouts. There is no underlying issue with our approach, instead if the user really uses this way of rendering something, Neither the frameworks not our library would be able to track it. Unless we monkey patch. |
| Wrote a detailed comment on the double setTimeout tests https://github.com/elastic/apm-agent-rum-js/pull/730/files#diff-c6439d182e960bb8b3e580ba6c8e250aR61-R88 and also moved them to edge case test. |
ff295d9 to a01478d Compare 99aa49d to e432b19 Compare | Lazy component mount cannot be solved with this PR as our Route component wont be even kicked in(Transaction will not start until React fetches all underlying dependencies) when the dependencies are being fixed. Also this PR is not for addressing that issue, instead measuring everything that happens before the browser renders the next frame in a better way. However I added tests when lazy components are fetched inside a component that is child of our Lazy components can be still measured effectively by the technique already mentioned here - https://www.elastic.co/guide/en/apm/agent/rum-js/current/react-integration.html#_instrumenting_lazy_loaded_routes |
* feat(rum-core): end spa navigations after browser frame * chore: fix vue tests * chore: add test for after-frame * chore: add react.lazy e2e test * chore: handle for double timeout * chore: fix react e2e test * chore: split tests and address review * chore: update lazy documentation * chore: add lazy test
There is a detailed blog post explaining different ways to schedule a call after next frame. We are using the
rAF+setTimeouttechnique as we want the call to get executed even if the tab is opened in invisible mode (cmd + click).Pros
RAFnever gets called for invisible tabs.Cons
setTimeout(task, 1000)since it could be scheduled by the browser in next to next frames and we only measure the next frame after the navigation. This should be okay as it is not a usual thing.16.67msworst case due to the use of rAF, but we would be able to capture something the frameworks/user is doing during layout so might be worth it.Personal Opinion, I like this solution better than the other one due to its simplicity and solving for 99% of the use cases. Was able to work for most of the cases when the call is scheduled in
setImmediate,setTimeout(call, 0),requestAnimationFrame,requestIdleCallback,Promise.resolve,MessageChannelduring manual testing.