Capture Resource Timing Data Without Loss
Most browsers stop capturing resource timing data in a page when the number of resources reaches 150 because of the limit set by the Resource Timing API. You can configure the JavaScript Agent for conventional web pages (non-single page applications) and single-page applications (SPAs), however, to overcome this limitation.
Because the JavaScript Agent configuration is different for non-SPA and SPA, see these sections for details and instructions:
Set and Clear the Resource Timing Buffer for Non-SPAs
For non-SPAs, you can configure the JavaScript Agent to use a buffer to capture resource timing data and then set a flag to clear the buffer once the beacon has transmitted the resource timing data to the EUM Server. Clearing the buffer clears the browser's resource buffer array and ensures that new resources will be sent in the next beacon.
JavaScript Configuration Example
The resTiming object is used for configuring the buffer size (maximum number of resources to return) and whether the buffer is reset once the beacon is transmitted to the EUM Server. The code snippet below shows you how to specify the buffer size and set the flag for clearing the buffer with the properties bufSize and clearResTimingOnBeaconSend.
<head>
<script type='text/javascript' charset='UTF-8'>
window['adrum-config'] = {
resTiming: {
bufSize: 200,
clearResTimingOnBeaconSend: true
}
};
</script>
<script src='//cdn.appdynamics.com/adrum/adrum-latest.js' type='text/javascript' charset='UTF-8'></script>
</head>
Disable the Clearing of the Resource Timing Buffer for SPAs
For SPAs, the JavaScript Agent by default clears the resource timing buffer after it's full and saves the data in a local buffer. You can configure the JavaScript Agent so that the resource timing buffer is not cleared to capture resource timing data.
JavaScript Configuration Example
The default for clearResTiming is true. Setting clearResTiming to false, as shown below, disables the automatic clearing of the resource timing buffer. The resource timing buffer for virtual pages will also not be cleared.
window['adrum-config'] = {
...
"spa": {
"spa2": {"clearResTiming": false}
}
}