-
Notifications
You must be signed in to change notification settings - Fork 85
feat(web-sdk): add Navigation event instrumentation #1317
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
Hi @eskirk Let's reconsider the purpose and function of the instrumentation. The current method generates an event for every history event, which is excessive and doesn't provide valuable data for Real User Monitoring (RUM). This results in a high volume of events with limited insights. Instead, let's focus on the essential insights and data users require. Primarily, this involves user navigation, specifically "route changes" or "soft navigations." The crucial data here is tracking these changes, similar to our React Router instrumentation, including for example "from" and "to" routes (it's already part of some events). It's also important to differentiate between a soft navigation and a URL update that simply defines state on the same page. This is complex, but we can begin with a simpler approach. For instance, if only query parameters change between the new and old URLs, it's likely not a navigation. The WICG proposal on detecting soft navigations may offer some useful inspiration. Next steps / iterations would be to update the instrumentation to track important metrics to assess the health and performance of the navigations. |
private currentHash: string | null = null; | ||
|
||
initialize() { | ||
console.log('NavigationInstrumentation initialized', { |
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.
console.log
}); | ||
}; | ||
|
||
window.addEventListener('popstate', (event) => { |
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.
Popstate will be triggered for history.back(),
.forward()
and .go()
.
So we always send two events.
I assume these are considered as something like sidecar events to provide more context ?
Let's not enable them by default. It's technical browser events but not really related to the trace of the user.
For example we can provide a setting to let users enable them if they really need it.
Do you have an example how they enhance the RCA flow?
…ready instrumented
Why
very requested feature for JS apps that do not use React/react-router instrumentations.
What
this instrumentation will track page navigation and URL changes in any instrumented applications.
Links
#485
Checklist