-
Notifications
You must be signed in to change notification settings - Fork 130
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
RUM not automatically working with HashRouter #540
Comments
Hello Eduardo! Thanks for your report. In the Datadog UI, the "path" column is the actual URL path, and you should be able to add a column on I agree that in the "Hash router" case this is not convenient, having the hash directly would be better. I'll raise the issue internally. |
We are working on a solution for this, where the user can specify a view "name" to be displayed instead of the view path in the Datadog UI. You can have a sneak peek here: #724 . With this, it will be trivial to use the view hash instead of the path, with an API that may look like: DD_RUM.init({
// ...
onNewLocation(newLocation) {
return { viewName: newLocation.hash }
}
}) Woud this looks like a good solution for you? |
I think that's a pretty solid solution, seems nice and flexible for the users. Thanks for the link to the PR! |
Hello! Since browser-sdk@2.17.0, you can now track views manually and define your own view names. |
Why this cannot work OOB? I think instead of having only path in View path, adding hash there would make sense as well, at least with opt-in in I think modifying source code, adding some hooks for router when route changes and calling datadog on that - would be prone to errors. Especially because this feature specifies |
Hi @strowk, We could consider to introduce this kind of configuration at some point but it is not in our priorities right now. I think you could use beforeSend API to update events view url., in order to transform Would that work for you? |
Hi @bcaudan , Hm, I see this snippet in example
Tried it like this
have this in log
No effect on RUM webconsole, still shows just '/' for view.. |
FMU, your code will transform view url this way:
Since you still need a valid URL, it could work better with something like:
resulting in:
|
I tried replacing hash with slash - this worked, sort of, but does not seem to be very stable. Sometimes I still get something like I will wait for this issue to get proper resolution and full support of hash router (or rejection if you choose to do so), before proceeding. In the meantime I guess we just have to ignore "view" in RUM webconsole |
I think hash routing should work out of the box. Should be no need to implement the following approach: event.view.url = event.view.url.replace('#', '') |
Hi!
I'm integrating the
@datadog/browser-rum
with at our react (16.12.0) application that uses react-router-dom (5.1.2) to manage the routers.We are currently using
HashRouter
and due to already existing analysis data, we can't migrate fromHashRouter
toBrowserRouter
without having the/#
prefixed.Basically, the issue we have is that the
@datadog/browser-rum
seems not to be integrating withHashRouter
very well. I uploaded some code I was using to debug here https://github.com/eduardogspereira/datadog-debug, but basically I'm setting the datadogRum and router like this:Even that the
hashchange
event is being triggered, the paths are not being correct updated at datadog:Also, we trying to migrate from
HashRouter
toBrowserRouter
keeping the/#
prefixed. Like this:But with this approach the datadogRum don't update the locationPath also.
It's possible that this is a bug?
Thanks!
The text was updated successfully, but these errors were encountered: