Enable data capturing for your mobile frontends in the New RUM Experience

  • Latest Dynatrace
  • How-to guide
  • 5-min read
  • Preview

This guide provides essential information for setting up and utilizing the New RUM Experience for iOS and Android platforms. Follow the instructions below to ensure a smooth setup and optimal performance.

Enabling ingest to Grail has no impact on the classic data capturing. Dashboards, alerting and configurations on classic as well as billing are not impacted.

Enable the New RUM Experience for iOS and Android

  1. Go to Experience Vitals Experience Vitals.
  2. Select Mobile to view all mobile frontends.
  3. Select the frontend you want to configure.
  4. Navigate to the Settings tab.
  5. Under Enablement and cost control, turn on New Real User Monitoring Experience.
  6. Update your OneAgent for Mobile to the latest version.
  7. Start the app in your local environment, and wait until OneAgent for Mobile downloads the new configuration.
  8. Wait for the current session to timeout, update user privacy options, or restart the app, so the new configuration takes effect.

Enable the New RUM Experience at the environment level

To enable the New RUM Experience for web frontends at the environment level

  1. Go to Settings Settings > Collect and capture > Real User Monitoring > Traffic and cost control > Frontend - mobile.
  2. Turn on Enable New Real User Monitoring Experience.

Set up your mobile app for New RUM Experience

Make sure you have the following settings in your app:

  • Verify that the cost control settings for your application is set to 100%. If you set it below that threshold, not all sessions' events will be reported to Grail.
  • Server Firewall: Ensure that you allow the traceparent HTTP header.
  • Data Privacy: Set the data collection level to PERFORMANCE or USER_BEHAVIOR.
  • To report crashes, your user must opt-in for data privacy compliance.
  • To avoid session timeouts, ensure proper session management for Grail activation.

User events automatically reported to Grail (iOS and Android)

In the New RUM experience, RUM data is captured as user events, which are stored in the user.events table. The following user events are captured and stored in Grail:

  • Crash Reporting: Reported as mobile error events
  • Web requests: HttpURLConnection and OkHttp requests reported as request events
  • Visibility change event
  • Mobile app start event

ANR Reporting for mobile

With the New RUM Experience, Dynatrace automatically captures “Application Not Responding”(ANR) errors. ANRs are critical to monitor as they cause frustration to the user. The main problem is that the app's main thread, which is responsible for updating the UI, can't process user input events or draw, forcing the app to be closed.

These events are sent only if the mobile app is restarted within a timeframe of 10 minutes by the user.

By default, this feature is turned on. To turn it off use the following configuration options:

Android

OneAgent only reports ANR errors on devices with Android 11 or higher. On older Android versions, the ANR Error event is not available.

Using the ConfigurationBuilder when starting the agent manually:

public ConfigurationBuilder withAnrReporting(boolean enabled)

Using the DSL:

dynatrace {
configurations {
sampleConfig {
anrReporting false
...
}
}
}

iOS

Using the dictionary configuration when starting the agent manually:

Dynatrace.startup(withConfig: ["DTXANRReportingEnabled": false,])

Using the plist file:

<key>DTXANRReportingEnabled</key>
<false/>

React Native

Using the dynatrace.config.js file:

module.exports = {
react: {
...
},
android: {
// Those configs are copied 1:1
config: `
dynatrace {
configurations {
defaultConfig {
...
anrReporting false
}
}
}
`
},
ios: {
// Those configs are copied 1:1
config: `
...
<key>DTXANRReportingEnabled</key>
<false/>
`
}

Flutter

Using the dynatrace.config.yaml file:

android:
config:
"dynatrace {
configurations {
defaultConfig {
...
anrReporting false
}
}
}"
ios:
config:
"...
<key>DTXANRReportingEnabled</key>
<false/>"

MAUI

Using the dynatrace.config.json file:

{
"android": {
"autoStart": {
"beaconUrl": "https://...",
"applicationId": "..."
},
"anrReporting": false
},
"ios": {
"DTXBeaconUrl": "https://...",
"DTXApplicationId": "...",
"DTXANRReportingEnabled": false
}
}

Native Crash Reporting for Android

Native crashes are crashes that originate in C/C++ code added via NDK. The official Android documentation lists examples and how to diagnose them.

With the New RUM Experience, Dynatrace automatically captures native crashes. Events are sent only if the mobile app is restarted within a timeframe of 10 minutes by the end user.

By default, this feature is turned on. To turn it off use the following configuration options:

  • On older Android versions, the ANR Error event is not available. OneAgent only reports ANR errors on devices with Android 11 or higher. For Android 11 or higher, using the ConfigurationBuilder when starting the agent manually:

    public ConfigurationBuilder withNativeCrashReporting(boolean enabled)
  • Using the DSL:

    dynatrace {
    configurations {
    sampleConfig {
    nativeCrashReporting false
    ...
    }
    }
    }

Enable instant capturing of user events

Once new RUM is enabled for a mobile app monitored by Dynatrace, data is stored in Grail. On each end user device on which the mobile app is installed, the new configuration will be applied only after the first user session is finished. Upon the very first app start OneAgent will initiate non-Grail communication and upgrade to Grail only if ordered by server configuration, and only on the next app start.

Hence, the first session will be captured only on RUM Classic, unless the following build-time configuration is additionally applied:

Android

To avoid that and to start with Grail right away, the startupWithGrailEnabled flag must be set to true.

This can be done using the ConfigurationBuilder:

public ConfigurationBuilder withStartupWithGrailEnabled(boolean enabled)

Using the DSL:

dynatrace {
configurations {
sampleConfig {
agentBehavior {
startupWithGrailEnabled true
}
}
}
}

iOS

To avoid that and to start with Grail right away, the DTXStartupWithGrailEnabled flag must be set to true.

This can be done in the .plist file:

<key>DTXStartupWithGrailEnabled</key>
<true/>

If the Dynatrace.startup(withConfig:) method is used, it needs to be added there.

Dynatrace.startup(withConfig: ["DTXStartupWithGrailEnabled": true,])

React Native

Using the dynatrace.config.js file:

module.exports = {
react: {
...
},
android: {
// Those configs are copied 1:1
config: `
dynatrace {
configurations {
defaultConfig {
...
agentBehavior {
startupWithGrailEnabled true
}
}
}
}
`
},
ios: {
// Those configs are copied 1:1
config: `
...
<key>DTXStartupWithGrailEnabled</key>
<true/>
`
}

Flutter

Using the dynatrace.config.yaml file:

android:
config:
"dynatrace {
configurations {
defaultConfig {
...
agentBehavior {
startupWithGrailEnabled true
}
}
}
}"
ios:
config:
"...
<key>DTXStartupWithGrailEnabled</key>
<true/>"

MAUI

Using the dynatrace.config.json file:

{
"android": {
"autoStart": {
"beaconUrl": "https://...",
"applicationId": "..."
},
"agentBehavior": {
"startupWithGrailEnabled": true
}
},
"ios": {
"DTXBeaconUrl": "https://...",
"DTXApplicationId": "...",
"DTXStartupWithGrailEnabled": true
}
}

Additional Android instructions

Add custom OkHttp client

OneAgent for Android now allows you to specify a custom OkHttp client to use for network requests, that are used to transmit RUM data to Grail.

This can be set using manual startup with the ConfigurationBuilder:

public ConfigurationBuilder withOkHttpClient(okhttp3.OkHttpClient httpClient)

Likewise, an OkHttp factory can be provided to achieve the same result:

public ConfigurationBuilder withOkHttpFactory(okhttp3.Call.Factory httpFactory)

Dependencies for Android

  • Kotlin stdlib 2.0.21
  • Kotlin Coroutines 1.7.1
  • OkHttp 4.12.0
  • Jetpack Preferences DataStore 1.0.0
  • Jetpack Room 2.6.1
  • Squareup Wire 5.3.1

Additional iOS instructions

Dependencies for iOS

Agent

Swift Instrumentor

Unsupported features

  • Regarding manual instrumentation:

    • Dynatrace#getRequestTagHeader, Dynatrace#getRequestTag, Dynatrace#tagRequest, DTXAction#getRequestTagHeader, DTXAction#getRequestTag, DTXAction#tagRequest only support web request tagged with the x-dynatrace header. There is no API support for manual tagging with the traceparent header.
    • You can only use Dynatrace#getWebRequestTiming for http or web socket monitoring.
  • Regarding missing data:

    • User actions
    • Custom value reporting (values and events) - to capture these in Grail as well, additionally use the new APIs above
    • Lifecycle events
    • Rage tap events
    • Session end event
    • Session replay

Limitations

  • ANR and crashes are not reported immediately, they get sent to Grail as soon as a user restarts the app.
  • Cost control settings are only applied partially. The first events of a discarded session are visible in Grail. This won't lead to any additional costs.
  • The agent doesn't immediately report events when your app moves to the background, they're reported within 2 minutes.
  • After enabling the New RUM experience, the initial user session is still captured using RUM Classic unless startup flags are set. For more information, see Enable instant capturing of user events.
Related tags
Digital Experience