Set up agentless Real User Monitoring
Agentless monitoring is designed to be used when you don't have access to your web server and therefore can't install OneAgent. However, before deciding on a third-party library, note that the full benefits of Real User Monitoring can be obtained only after you’ve installed Dynatrace OneAgent.
For some technologies, automatic RUM JavaScript injection is not supported even when you can install OneAgent. For example, while OneAgent can monitor the server side of a Heroku application, it cannot inject the RUM JavaScript into the application's pages. If that's the case, you need to manually add the RUM JavaScript to your application's pages.
For a list of technologies and servers that support automatic RUM JavaScript injection, see Technology support - Real User Monitoring - Web servers and applications.
The installation of Dynatrace OneAgent is highly recommended for the following reasons:
- With agentless monitoring, you need to manually insert the RUM JavaScript into each of your application’s pages, which can be challenging. Dynatrace OneAgent handles the insertion of the RUM JavaScript for you.
- Unless you use the code snippet or JavaScript tag insertion option for agentless monitoring, the RUM JavaScript embedded into your application’s pages won't be automatically updated when you change application monitoring settings. You’ll have to update the code manually.
Performance impact
To minimize the impact on page-load time and your users’ first impressions of your application, you might want to load scripts as late as possible. Use blocking script tags to ensure that your RUM JavaScript will be executed exactly where you place it. If you need a script to run as early as possible, the execution can’t be postponed. One way to avoid these additional blocking requests during page load is to inline the script code. The script code needs to be inlined into each document, thereby propagating the data of a single cached file into every page of your application. By combining both these approaches, you can get an inline JavaScript snippet that performs the required initialization and defers loading of the big bulk of the code to a second script.
Standards and security policies
Certain development standards that are created to make applications more secure and faster also introduce new limitations. For example, the Content Security Policy (CSP) standard was introduced to minimize the chance of becoming a victim of cross-site scripting, thereby disallowing inline JavaScript code. This means that you have to use a simple JavaScript tag to inject the RUM JavaScript.
Another standard, the AMP project, aims to provide a framework that helps you build applications that are consistently fast across all devices and system platforms. In this case, self-developed and third-party JavaScript code isn't allowed; only scripts provided by AMP can be used.
To monitor AMP applications with Dynatrace
- In the Dynatrace menu, go to Deploy Dynatrace.
- Select Setup agentless or AMP monitoring.
- Turn on My application relies on Accelerated Mobile Pages (AMP).
Maintenance effort
Agentless monitoring requires you to insert tags by yourself, which is why you must ensure that it requires as little manual effort as possible. You don’t want to have to change your code every time your configuration changes or when a new version is released. The code snippet added to your application usually doesn't need to be changed as it takes care of loading the right configuration and version for you.
Insertion methods
The RUM JavaScript insertion format depends on the application and your requirements. Find out about the available options for the RUM JavaScript insertion.
To choose an agentless Real User Monitoring insertion approach
- In the Dynatrace menu, go to Web.
- Select the application that you want to configure.
- In the upper-right corner of the application overview page, select More (…) > Edit.
- From the application settings, go to Injection > Injection.
- Go to the Manual insertion tab, and select the required format.
REST API
Dynatrace offers a REST API that allows you to automatically retrieve the latest RUM JavaScript for your application. You can automatically inject the latest code or tag during the build time of your application. To learn how to use the API, see Real User Monitoring JavaScript API.
You can also retrieve URL to download the RUM JavaScript as HTML tag in Dynatrace.
- In the Dynatrace menu, go to Web.
- Select the application that you want to configure.
- In the upper-right corner of the application overview page, select More (…) > Edit.
- From the application settings, go to Injection > Injection.
- Go to the Retrieve via API tab, and select the required format.
- Select Copy to retrieve the download URL.
Prerequisites
Here's what you'll need to set up agentless Real User Monitoring:
- RUM JavaScript—a custom JavaScript code or tag generated by Dynatrace
- Access to your application’s HTML source so that you can insert the RUM JavaScript
- (Managed deployments only) A CDN to serve the RUM JavaScript that will prevent web page performance problems during Dynatrace Managed Server maintenance periods or local network outages
Set up agentless monitoring
User action to distributed trace correlation
For agentless monitoring, the ability to link user actions and distributed traces depends on the technologies that your application uses.
- If your application is instrumented with OneAgent, but Real User Monitoring is not supported for its technology, then the distributed traces captured by this OneAgent cannot be linked to user actions.
- If your application issues XHR calls to AWS Lambda or to another instrumented web or app server that uses the supported technologies, then it is possible to link user actions and distributed traces. However, these web requests are usually cross-origin requests, so additional configuration is needed to achieve the user action to distributed trace correlation. See Link cross-origin XHR user actions and their distributed traces for details.