Custom transaction for single page applications route changes

Hi,

We want to use custom transactions for client side navigations in a single page application, as suggested by the documentation. However, we found that the RUM agent is already creating automatically transactions for route changes (transaction.type = "route-change").

As the RUM agent don't support to have multiple open transactions simultaneously, our custom transaction is automatically closed when the agent creates the "route-change" transaction automatically.

Is there any way to disable the automatic monitoring of the route changes events?

Thanks;

Hi @jesusgarcia,

Thanks for reaching out and welcome to the forum.

Currently, it's not possible to disable the automatic instrumentations we have this issue to address this.

Would you please provide more detail about your use-case?
Would it work in your case, if the route-change transaction used the custom transaction you've created and only extended/renamed it?

Cheers,
Hamid

Hi Hamidreza:

There are three reasons why that automatic instrumentation is not enough for us, and why we thought that creating custom transactions could solve our problem:

  1. In our application, the navigation performs some tasks before actually try to change the browser url (history.pushState) which is when the automatic instrumentation starts the 'route-change' transaction. This tasks do some requests to our backends that we want to include as spans in the 'navigation' transaction.
  2. On the other hand, the automatic 'route-change' transaction is ended before when we consider the navigation has finished, hence not reporting some requests and reporting a shorter duration
  3. We as well want to customise the transaction name; 'route-change' transactions are reported with 'Unknown' in name because we don't update the browser title.

Thanks in advance !

Thanks for your reply @jesusgarcia!

I've also created this issue to make handling automatic vs manual instrumentations easier to use.

Thanks Hamidreza,

If I understood correctly, from what I read in the issue, I don't think that approach fit our particular needs.

Removing the automatic spans capturing for 'manual mode' transactions stop us from using that 'manual mode' for for client navigations transactions, since we are mostly interested in those spans. On the other hand, if we use the 'automatic mode', we'll have the same problems since the 'route-change' transaction will 'kill' our custom transaction.

It would be possible to just add a setting flag to enable/disable automatic 'route-change' instrumentation?

Thanks !

Hi @jesusgarcia,

We've decided to provide both of the solutions described in #192 and #334. Therefore, you would be able to choose the one that fits your use-case.

Cheers,
Hamid

Thanks, that would be great.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.