cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Separate nesting of the XHR actions individually

Suryanto_1
Helper

we have discovered that some applications will trigger multiple XHR Urls in a single click, The multiple XHR urls will then select one XHR as the main user action and the rest will be nested as a sub-action, and the ones registered as sub-actions can't be queried using the USQL.

This causes issues as the XHR url we are identifying to use as the end of transaction is not recorded as the main user action and cannot be queried using the USQL. We've managed to find a workaround which is to exclude certain URLs using XHR exclusions. But that might be an issue if there are 4-5 XHR urls triggered in a single click action.

How does Dynatrace detect and identify which XHR Url to use as the main user action? It may not be feasible to be excluding all the URLs in case we ever need the metrics for performance monitoring.

As the workaround may not be ideal as a long term solution, is there an alternative configuration/method that we can use to separate the XHR actions in the user sessions?

13 REPLIES 13

marina_pollehn
DynaMight Champion
DynaMight Champion

Can you show an example of a user action and the sub-actions? 

For example if they have different domains you can use the advanced configuration option and get different actions per domain.

marina_pollehn_0-1698141215996.png

 

A Dynatrace Professional nerd working for Conclusion Xforce

Suryanto_1
Helper

The Multiple XHR Urls in a single click example is as follows.

It could be an external site not just an internal site.

Please advice how to configure the user actions in the specific application


XHR Request

/extensions
https://VWXYZ.ABCDE.FGH/TUVWXYZ/api/v1/extensions 

/Tealeaf?1234567890123
https://ABCDE.FGH/ABC/ABC-servlets/Tealeaf?1234567890123 

/new
https://Complete.new.unrelevant.site/ab.cdef/cs1 

Julius_Loman
DynaMight Legend
DynaMight Legend

Hi @Suryanto_1

you mention multiple XHRs in "a single click" - this pretty much means it's a single user action (XHR user action unless it does full page load), despite many XHR requests being triggered within the action. Real user monitoring's purpose is to capture user perception and experience, thus it's designed to capture the user activity (actions) and attach the individual requests. You need to distinguish between XHR user actions and XHR requests.

If for some reason to change the behaviour of how the user actions are structured, there are multiple methods depending on your goals and your application code, most likely you will need to use RUM JavaScript API

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Suryanto_1
Helper

XHR user actions trgger multiple XHR requests. The request can be various internal or external links.

The multiple XHR urls will then select one XHR as the main user action and the rest will be nested as a sub-action.


How does Dynatrace detect and identify which XHR Url to use as the main user action?

Can those registered as sub-actions can be queried using the USQL? As per our testing this isnt possible.


We are trying to calculate the TCR. It causes issues as the XHR url we are identifying to use as the end of transaction

It is not recorded as the main user action and cannot be queried using the USQL. This is not something in-build? 

 

 

You define your user action name (this can be accomplished for example by the user action naming rules which @marina_pollehn mentions, by setting it explicitly from the RUM JS Api or also by other means). This is just a name of the user action, and typically it should describe the activity user is performing. (e.g. Purchase order) not the individual XHR request name, which can depending on the situation also fit.

With USQL you cannot query waterfall detail, it's designed for session data segmentation and analysis (more targeted for the business persona). For detailed request analysis there are other options within Dynatrace.

I don't know what do you mean by TCR, can you please elaborate more on the desired outcome? (Preferably including screenshots from your user actions).

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Thank you @Julius_Loman for your answers! Did you find the solution for your issue here @Suryanto_1 or do you require some further guidance? 🙂

Suryanto_1
Helper

Understand that USQL cannot query waterfall detail

Currently a single XHR action (user action name - internal1)

>> request (internal resource) internal1
>> request (external resource) wwww.aaaaa.com
>> request (external resource) bbbbb.xyz

We want it to become 3 XHR action so that we can query the action using USQL

XHR action (user action name - internal1)
XHR action (user action name - wwww.aaaa.com) (assuming e.g. Purchase order)
XHR action (user action name - bbbbb.xyz) (assuming e.g. Inventory)


Using the "User action naming rule" please advice what should we be configuring.

The following are all enable by default.

- Split user actions by domain
- Case insensitive naming
- Prioritize load actions and use value of last

As I stated previously - you are mixing XHR actions and XHR requests. RUM is designed for capturing activity, so it captures user actions. 

Your user performs one activity - a single click which results into 3 XHR requests. Probably the only way to separate that into 3 user actions would be to call the RUM API in your application code when those (at least two) XHR requests are fired. This cannot be accomplished by user action naming rules or standard RUM configuration.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Suryanto_1
Helper

This is what we have for now. Everything appears to be default.

Please give example on how to configure to meet the above requirements. Thanks!

user action naming rules.png

Suryanto_1
Helper

The RUM API link you given point to "Create custom user action names for web applications"

https://docs.dynatrace.com/docs/platform-modules/digital-experience/web-applications/initial-setup/c...

The configuration above seems to be all in the GUI - application settings. Where does the JavaScript API come in place?

@Suryanto_1 you still don't get the point. You cannot "split" a single user action into multiple actions using just Dynatrace configuration. You need to use other means such as dtrum API to create multiple user actions if that is your goal. You need to change your application to use the JavaScript API to create custom actions from your code. 

RUM is based on user action. One click is a single user action unless you change the behaviour by calling the JavaScript API from your web application to modify how the action is detected and reported back.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Hi Julius

I am in a similar situation as the original post. We are experimenting with the javascript api to create custom actions on our angular application. We have a few problems.

  • The enter action and leave action methods are still unpredictable to us and the custom action still does capture xhr calls that are beyond the leave action. This brings up the question, how does dynatrace decide what xhr calls to capture under a specific custom user action. Maybe this will give us an idea on what we might be missing.
  • If dynatrace is automatically capturing any user actions how will they be reported together. Can one xhr call be only reported under one user action (custom or automatic)? And how does dynatrace drive that reporting. If an xhr call occurs between a enteraction and leaveaction call, is it a guarantee that it will not be captured as part of the automatically captured user action?
  • For eg - this is a scenario we are struggling with - User clicks a button - a couple of xhr calls are fired, the  angular app then updates the browser url and there are a few more xhr calls fired. We would like to separate out what happens before the browser url is updated. We tried using RUM API but it seems to still capture whatever happens on the next page after the browser url is updated.

For the first point - you are talking about custom action and you call leaveAction and the XHR call happens after?

Afaik one XHR call can be attached to a single user action only. You do have overlapping actions? (custom action and XHR action)

I'm not sure if the last point can be achieved trivially. The concept is about capturing user interactions. There is just one interaction - the user clicks a button. Maybe by calling leaveXhrAction (you need to capture the Action ID with addEnterActionListener and then create a new Xhr action manually and most likely you will need to attach Xhr calls.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts