Dynatrace Integration for Mobile App Monitoring (APM)
Dynatrace differs from Datadog and New Relic in its instrumentation approach: instead of manually placing tracking calls, the Dynatrace OneAgent uses automatic dependency discovery via the AI engine Davis. On mobile, this means most HTTP calls, crashes, and UI freezes are tracked immediately after adding the SDK without writing code.
Installing OneAgent Mobile
iOS:
// Podfile
pod 'Dynatrace', '~> 8.0'
// Or Swift Package Manager
.package(url: "https://github.com/Dynatrace/swift-mobile-sdk", from: "8.0.0")
import Dynatrace
// Info.plist or programmatic init
DTXApplicationID = "your-application-id"
DTXBeaconURL = "https://your-environment.live.dynatrace.com/mbeacon"
// In code:
Dynatrace.startupWithConfig(nil)
Dynatrace uses its own beacon endpoint (/mbeacon), not the standard ingestion API. If your app uses certificate pinning, add *.live.dynatrace.com to the whitelist or use DTXClusterURL with a custom proxy.
Android:
// build.gradle (project)
classpath("com.dynatrace.tools.android:gradle-plugin:8.+")
// build.gradle (app)
apply plugin: 'com.dynatrace.instrumentation'
// assets/dynatrace.properties
DTXApplicationID=your-application-id
DTXBeaconURL=https://your-environment.live.dynatrace.com/mbeacon
The Dynatrace Gradle plugin is heavier than New Relic on build time. On large projects with 50k+ classes, incremental build time can increase by 15–30 seconds.
User Actions
Dynatrace groups everything that happens between a user tap and completion of the triggered operations into a User Action. This is the key entity: you see how long it took to load data after a button tap.
For custom actions:
let action = Dynatrace.enterAction("AddToCart")
// ... do work ...
action?.leaveAction()
If a URLSession request happens inside enterAction/leaveAction, Dynatrace automatically binds it to that User Action. In the dashboard, Waterfall view shows the chain: gesture → data sync → API request → render.
Distributed Tracing
Dynatrace supports W3C traceparent and its own x-dynatrace format. For backend correlation:
// Manual tagging for custom HTTP clients
if let requestTag = Dynatrace.getDynatraceStringTag() {
request.setValue(requestTag, forHTTPHeaderField: "x-dynatrace")
}
In Dynatrace Smartscape, you see the entire path from mobile tap to database query on one screen — this is what enterprise customers pay for.
Common Integration Mistakes
Double initialization. With SwiftUI + SceneDelegate, sometimes startupWithConfig is called twice — from AppDelegate and from Scene(_:willConnectTo:). Dynatrace silently ignores the second call, but session ID resets, breaking session attribution.
ProGuard and R8. The Gradle plugin adds mapping files to the dashboard automatically, but only if uploadEnabled = true in dynatrace.properties. Without it, stack traces in crash reports are obfuscated.
Beacon URL in debug builds. Don't forget to switch DTXBeaconURL for dev/staging environments — test traffic in production pollutes metrics.
What We Do
- Connect OneAgent via Gradle plugin (Android) and SPM/CocoaPods (iOS)
- Configure beacon URL and Application ID for each environment
- Instrument custom HTTP clients (Alamofire, Retrofit) for distributed traces
- Configure User Actions for key user scenarios
- Set up Davis AI Anomaly Detection for baseline metrics
Timeline
Basic integration with auto-instrumentation: 2–3 days. Configuring distributed traces and custom User Actions: another 1 day. Pricing is calculated individually.







