"Browser was not responsive enough during the transaction"


I'm trying to use the JS RUM agent to measure and track ajax requests whilst a user is on a page (after page is loaded)

Following instructions from this post I have the following

window.addEventListener('load', function(e) {    
    var pageTransaction = apm.startTransaction(pageName, 'on-page', { managed: true })
    var pageTask = pageTransaction.addTask('on-page-task');

window.addEventListener("beforeunload", function() {
    pageTransaction.removeTask(pageTask )

All ajax request after page load are getting logged correctly into the new transaction, and distributed tracing is working, however when I do pageTransaction.end() I am getting logs along the lines of

Transaction was discarded! Browser was not responsive enough during the transaction.  duration: 46331.14500006195  browserResponsivenessCounter: 85 interval: 500

What does this mean, and do I have any influence on the 'browserResponsiveness'?
It doesn't seem to make any difference if I do this manually from the console, or in the beforeunload event...

Hi @cosmo,

Thanks for reaching out.

In the RUM agent we check the browser responsiveness during the lifetime of a transaction and there are a few reasons for that. The main reason, however, is that browsers heavily throttle tabs when the user moves away from them. This means that a transaction might have a very long duration and seemingly nothing has happened during its lifetime while in reality the user has moved away from that page.

In this case, it seems that you want to measure the time, the user has spent on the page, while you can do that with the RUM agent, it does not fit the Application Performance Monitoring that the RUM agent is designed to do. However, we are aware of this use-case and we are investigating ways to facilitate it.

Finally, you can disable this check by setting checkBrowserResponsiveness: false in the configuration, but please be aware that this might result in skewed values in the APM dashboard.