Header background

Automate configuration changes by leveraging the extended Real User Monitoring APIs

The Dynatrace Configuration API now includes several RUM APIs for mobile and web applications, allowing you to easily automate configuration changes and integrate with the Dynatrace Software Intelligence Platform.

If there’s one thing we’ve learned over the last few years, it’s that there’s an ever-growing need for automation in setting up and configuring your environments at scale. Our bigger customers have 100+ applications in a single monitoring environment, while our biggest customer have 1000+ applications in multiple such environments.

The need for automation often becomes evident right after setting up your first Real User Monitoring applications, be they for your mobile or web applications, when you realize you want to leverage previous RUM configurations in a new application. For example, you might want to move certain user action naming rules from one application to the other. Or you might want to copy the entire configuration from your development environment to your production environment. Approaching either of these challenges manually isn’t a viable solution, given the scale and the accelerating rate at which configurations change.

Enterprise-ready Real User Monitoring APIs for mobile and web

The Dynatrace Configuration API has long enabled our customers to keep track of their monitoring environment configurations. Now we’ve broadly expanded this API to cover both mobile and web applications, allowing you to easily automate configuration changes and integrate with other workflows and data flows in the Dynatrace Software Intelligence Platform.

Let’s take a look at two example use cases.

Automatically transfer user action naming rules between environments

At Dynatrace, we monitor all our own webpages with Dynatrace. However, and this is true for all enterprises, you don’t usually have just one application or environment for monitoring both your preproduction and production systems. In the spirit of our “automate everything” mantra, you can now move any user action naming rule and all your placeholders in a completely automated way.

Let’s assume, for example, that after adding the user action naming rule loading of page {cleanedBookings} and the placeholder {cleanedBookings} for our EasyTravel application, we now want to move them to our production environment. Here’s how you can now do so with the help of the API:

  1. Get the application IDs of both (preproduction and production) web applications by checking both application overview pages. You can copy the application IDs from the browser URLs (as shown in the screenshot below) and jot them down—we’re going to need them later for making API requests.
    Copy the application ID from the application overview URL
  2. Assuming you’ve already created an API token with Read configuration and Write configuration access scopes, go to the Configuration API, e.g., by selecting the User menu at the top-right corner of the Dynatrace web UI.
  3. Select the RUM – Web application configuration group of endpoints.
    RUM - Web application configuration API
  4. Use the GET /applications/web/{id} endpoint to retrieve application configuration for both applications and open them in a code editor of your choice.
    User action naming rules in preproduction and production RUM applications
  5. Copy the user action naming rules and placeholders you want to move from one application to the other.
  6. In your code editor, insert the extracted action naming rules and placeholders into the configuration of the production environment.
    Copy user action naming rules and placeholders from one application to the other
  7. Apply the new configuration using the PUT /applications/web/{id} endpoint with the application ID of the production application.
    User action naming rules transferred to production application, shown in the Dynatrace UI

Easily manage the configuration of your mobile apps

A great opportunity to leverage the API for mobile (and custom) app management is when you deploy tested and approved apps to production. If you take great care to set up your test app environment, you can now easily make sure that it matches the production environment, and monitoring your production app with Dynatrace is no different.

So from now on, after you’ve tested a new Dynatrace configuration

  1. Fetch the freshly approved configuration from your test app with:
    GET <test environment base URL>/api/config/v1/applications/mobile/<test app identifier>
  2. Remove the keys:
    identifier and applicationId
  3. Update your production app with the following request:
    PUT <test environment base URL>/api/config/v1/applications/mobile/<production app identifier>

This way, your production configuration will always match what you just tested.

Note: For every API call you need an API token for the respective environment. You can retrieve tokens from Settings > Integration > Dynatrace API. When creating a token make sure you enable both the Read configuration and Write configuration access scopes.

New API configuration capabilities for Real User Monitoring

Here’s the list of all the new API configuration capabilities for Real User Monitoring that we’ve added in Dynatrace version 1.207. The API scope in terms of application type (for example, “web”) is indicated in parentheses.

  • Creation and management of applications (mobile and custom): Create your RUM applications programmatically.
  • User action naming rules (web): Create placeholders or configure related configurations such as “split user action by domain.”
  • Key user actions (web and mobile): Mark specific user actions as important.
  • User action and session properties (web and mobile): Create, edit, and remove user action and session properties.
  • User tags (web): Set the rules for how Dynatrace applications capture your user’s tags to identify users and enrich your session analysis.
  • Beacon domains (web): Add, edit, and remove domains for which beacons are allowed and accepted by Dynatrace to protect against malicious CORS requests.
  • IP-mapping rules for geographic regions (web and mobile): Add, edit, and remove IP mappings to determine the geographic regions of your users.
  • Content-resource rules and URL-cleanup rules (web): Add, edit, and remove clean-up rules to better group your URLs in places such as waterfall charts.
  • IP restrictions for monitoring (web): Add or remove certain IP addresses you want to exclude from monitoring.
  • Injection inclusion and exclusion rules (web): Add rules for pages you want to inject differently or that you want to exclude from RUM monitoring.
  • JavaScript tag injection settings (web): Configure injection-related settings such as cache settings.
  • Retrieval of the JavaScript code for manually inserted applications and the browser extension (web): Fetch the RUM monitoring code programmatically for all other injection types.
  • Host-detection headers (web): Programmatically specify the header that OneAgent uses to detect the host of your application for application detection and automatic injection of the RUM JavaScript tag.

What’s next

You will soon be able to configure the following Session Replay–related settings via API:

  • Session Replay data privacy settings (web): Set or adjust your application’s data privacy settings. For example, decide how masking rules should be applied during recording and playback.
  • Session Replay configuration (web): Enable/disable Session Replay or set cost control per application.

Seeing is believing

New to Dynatrace? Try it out by starting your free trial today.

Already part of the Dynatrace community? Please let us know whenever an API to configure your Real User Monitoring applications is still missing and share your feedback with us at Dynatrace Community.