Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS-9915] Mobile App Performance updates for iOS and Android #27404

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
36 changes: 23 additions & 13 deletions config/_default/menus/main.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6677,36 +6677,41 @@ menu:
parent: rum_mobile_android
identifier: rum_mobile_android_crash
weight: 102
- name: Monitoring App Performance
url: real_user_monitoring/mobile_and_tv_monitoring/android/monitoring_app_performance
parent: rum_mobile_android
identifier: rum_mobile_android_monitoring_app_performance
weight: 103
- name: Advanced Configuration
url: real_user_monitoring/mobile_and_tv_monitoring/android/advanced_configuration
parent: rum_mobile_android
identifier: rum_mobile_android_advanced_config
weight: 103
weight: 104
- name: Data Collected
url: real_user_monitoring/mobile_and_tv_monitoring/android/data_collected
parent: rum_mobile_android
identifier: rum_mobile_android_data_collected
weight: 104
weight: 105
- name: Mobile Vitals
url: real_user_monitoring/mobile_and_tv_monitoring/android/mobile_vitals
parent: rum_mobile_android
identifier: rum_mobile_android_mobile_vitals
weight: 105
weight: 106
- name: Web View Tracking
url: real_user_monitoring/mobile_and_tv_monitoring/android/web_view_tracking
parent: rum_mobile_android
identifier: rum_mobile_android_web_view_tracking
weight: 106
weight: 107
- name: Integrated Libraries
url: real_user_monitoring/mobile_and_tv_monitoring/android/integrated_libraries
parent: rum_mobile_android
identifier: rum_mobile_android_integrated_libraries
weight: 107
weight: 108
- name: Troubleshooting
url: real_user_monitoring/mobile_and_tv_monitoring/android/troubleshooting
parent: rum_mobile_android
identifier: rum_mobile_android_troubleshooting
weight: 108
weight: 109
- name: iOS and tvOS
url: real_user_monitoring/mobile_and_tv_monitoring/ios
parent: mobile_and_tv_monitoring
Expand All @@ -6722,41 +6727,46 @@ menu:
parent: rum_mobile_ios
identifier: rum_mobile_ios_crash
weight: 102
- name: Mobile App Performance
url: real_user_monitoring/mobile_and_tv_monitoring/ios/monitoring_app_performance
parent: rum_mobile_ios
identifier: rum_mobile_ios_monitoring_app_performance
weight: 103
- name: Advanced Configuration
url: real_user_monitoring/mobile_and_tv_monitoring/ios/advanced_configuration
parent: rum_mobile_ios
identifier: rum_mobile_ios_advanced_config
weight: 103
weight: 104
- name: Data Collected
url: real_user_monitoring/mobile_and_tv_monitoring/ios/data_collected
parent: rum_mobile_ios
identifier: rum_mobile_ios_data_collected
weight: 104
weight: 105
- name: Mobile Vitals
url: real_user_monitoring/mobile_and_tv_monitoring/ios/mobile_vitals?tab=ios
parent: rum_mobile_ios
identifier: rum_mobile_ios_mobile_vitals
weight: 105
weight: 106
- name: Web View Tracking
url: real_user_monitoring/mobile_and_tv_monitoring/ios/web_view_tracking?tab=ios
parent: rum_mobile_ios
identifier: rum_mobile_ios_web_view_tracking
weight: 106
weight: 107
- name: Integrated Libraries
url: real_user_monitoring/mobile_and_tv_monitoring/ios/integrated_libraries
parent: rum_mobile_ios
identifier: rum_mobile_ios_integrated_libraries
weight: 107
weight: 108
- name: Troubleshooting
url: real_user_monitoring/mobile_and_tv_monitoring/ios/troubleshooting
parent: rum_mobile_ios
identifier: rum_mobile_ios_troubleshooting
weight: 108
weight: 109
- name: Supported Versions
url: real_user_monitoring/mobile_and_tv_monitoring/ios/supported_versions
parent: rum_mobile_ios
identifier: rum_mobile_ios_supported_versions
weight: 109
weight: 110
- name: Flutter
url: real_user_monitoring/mobile_and_tv_monitoring/flutter
parent: mobile_and_tv_monitoring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ To get started with RUM for Android, create an application and configure the And
{{< whatsnext desc="This section includes the following topics:">}}
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/setup">}}<u>Setup</u>: Learn how to set up the Android SDK, track background events, and send data when devices are offline.{{< /nextlink >}}
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/error_tracking">}}<u>Crash Reporting</u>: Add ANR detection and crash reporting, get deobfuscated stack traces, then test your implementation.{{< /nextlink >}}
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/monitoring_app_performance">}}<u>Monitoring App Performance</u>: Monitor view timings to understand your app's performance from a user's perspective. {{< /nextlink >}}
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/advanced_configuration">}}<u>Advanced Configuration</u>: Enrich user sessions, manage events and data, track custom global attributes and widgets, review initialization parameters, modify or drop RUM events, and more.{{< /nextlink >}}
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/mobile_vitals">}}<u>Data Collected</u>: Review data that the Android SDK collects.{{< /nextlink >}}
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/mobile_vitals">}}<u>Mobile Vitals</u>: View mobile vitals, which help compute insights about your mobile application.{{< /nextlink >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,58 +49,6 @@ In addition to [tracking views automatically][4], you can also track specific di
{{% /tab %}}
{{< /tabs >}}

### Notify the SDK that your view finished loading

iOS RUM tracks the time it takes for your view to load. To notify the SDK that your view has finished loading, call the `addViewLoadingTime(override=)` method
through the `GlobalRumMonitor` instance. Call this method when your view is fully loaded and displayed to the user:

{{< tabs >}}
{{% tab "Kotlin" %}}
```kotlin
@OptIn(ExperimentalRumApi::class)
fun onViewLoaded() {
GlobalRumMonitor.get().addViewLoadingTime(override = false)
}
```
{{% /tab %}}
{{% tab "Java" %}}
```java
@OptIn(markerClass = ExperimentalRumApi.class)
public void onViewLoaded() {
GlobalRumMonitor.get().addViewLoadingTime(override);
}
```
{{% /tab %}}
{{< /tabs >}}

Use the `override` option to replace the previously calculated loading time for the current view.

After the loading time is sent, it is accessible as `@view.loading_time` and is visible in the RUM UI.

**Note**: This API is still experimental and might change in the future.

### Add your own performance timing

In addition to RUM's default attributes, you can measure where your application is spending its time by using the `addTiming` API. The timing measure is relative to the start of the current RUM view. For example, you can time how long it takes for your hero image to appear:
{{< tabs >}}
{{% tab "Kotlin" %}}
```kotlin
fun onHeroImageLoaded() {
GlobalRumMonitor.get().addTiming("hero_image")
}
```
{{% /tab %}}
{{% tab "Java" %}}
```java
public void onHeroImageLoaded() {
GlobalRumMonitor.get().addTiming("hero_image");
}
```
{{% /tab %}}
{{< /tabs >}}

Once the timing is sent, the timing is accessible as `@view.custom_timings.<timing_name>`. For example: `@view.custom_timings.hero_image`. You must [create a measure][10] before graphing it in RUM analytics or in dashboards.

### Custom Actions

In addition to [tracking actions automatically][5], you can also track specific custom user actions (such as taps, clicks, and scrolls) with `RumMonitor#addAction`. For continuous action tracking (for example, tracking a user scrolling a list), use `RumMonitor#startAction` and `RumMonitor#stopAction`.
Expand Down Expand Up @@ -205,7 +153,7 @@ In addition to [tracking resources automatically][6], you can also track specifi

### Custom Errors

To track specific errors, notify the monitor when an error occurs with the message, source, exception, and additional attributes. Refer to the [Error Attributes documentation][9].
To track specific errors, notify the monitor when an error occurs with the message, source, exception, and additional attributes. Refer to the [Error Attributes documentation][7].

```kotlin
GlobalRumMonitor.get().addError(message, source, throwable, attributes)
Expand All @@ -223,7 +171,7 @@ fun addUserProperties(extraInfo: Map<String, Any?>, sdkCore: SdkCore = getInstan

## Event and data management

The Android SDK first stores events and only uploads events when the [intake specifications][11] conditions are met.
The Android SDK first stores events and only uploads events when the [intake specifications][8] conditions are met.

### Clear all data

Expand Down Expand Up @@ -261,7 +209,7 @@ You can control the buildup of events on the SDK with the `setBackpressureStrate
}
```

See an [example of this API][12] being used.
See an [example of this API][9] being used.

### Set remote log threshold

Expand Down Expand Up @@ -313,7 +261,7 @@ Datadog.setUserInfo('1234', 'John Doe', 'john@doe.com')

## Track widgets

Widgets are not automatically tracked with the SDK. To send UI interactions from your widgets manually, call the Datadog API. [See example][7].
Widgets are not automatically tracked with the SDK. To send UI interactions from your widgets manually, call the Datadog API. [See example][10].


## Initialization parameters
Expand Down Expand Up @@ -397,6 +345,12 @@ You can use the following methods in `RumConfiguration.Builder` when creating th
`setErrorEventMapper`
: Sets the EventMapper for the RUM ErrorEvent. you can use this interface implementation to modify the ErrorEvent attributes before serialization.

`setInitialResourceIdentifier`
: Sets a custom identifier for initial network resources used for [Time-to-Network-Settled][11] (TNS) view timing calculation.

`setLastInteractionIdentifier`
: Sets a custom identifier for the last interaction in the previous view used for [Interaction-to-Next-View[14]] (INV) timing calculation.
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
rtrieu marked this conversation as resolved.
Show resolved Hide resolved

`setLongTaskEventMapper`
: Sets the EventMapper for the RUM LongTaskEvent. You can use this interface implementation to modify the LongTaskEvent attributes before serialization.

Expand Down Expand Up @@ -494,7 +448,7 @@ For `ActivityViewTrackingStrategy`, `FragmentViewTrackingStrategy`, or `MixedVie

### Automatically track network requests

To get timing information in resources (such as third-party providers, network requests) such as time to first byte or DNS resolution, customize the `OkHttpClient` to add the [EventListener][8] factory:
To get timing information in resources (such as third-party providers, network requests) such as time to first byte or DNS resolution, customize the `OkHttpClient` to add the [EventListener][12] factory:

1. Add the Gradle dependency to the `dd-sdk-android-okhttp` library in the module-level `build.gradle` file:

Expand All @@ -504,7 +458,7 @@ To get timing information in resources (such as third-party providers, network r
}
```

2. Add add the [EventListener][8] factory:
2. Add add the [EventListener][12] factory:

{{< tabs >}}
{{% tab "Kotlin" %}}
Expand Down Expand Up @@ -572,7 +526,6 @@ For example, to replace the default `100 ms` duration, set a custom threshold in

To modify some attributes in your RUM events, or to drop some of the events entirely before batching, provide an implementation of `EventMapper<T>` when initializing the RUM Android SDK:


{{< tabs >}}
{{% tab "Kotlin" %}}
```kotlin
Expand Down Expand Up @@ -654,9 +607,9 @@ GlobalRumMonitor.get().getCurrentSessionId { sessionId ->
[4]: /real_user_monitoring/mobile_and_tv_monitoring/android/advanced_configuration/#automatically-track-views
[5]: /real_user_monitoring/mobile_and_tv_monitoring/android/advanced_configuration/#initialization-parameters
[6]: /real_user_monitoring/mobile_and_tv_monitoring/android/advanced_configuration/#automatically-track-network-requests
[7]: https://github.com/DataDog/dd-sdk-android/tree/master/sample/kotlin/src/main/kotlin/com/datadog/android/sample/widget
[8]: https://square.github.io/okhttp/features/events/
[9]: /real_user_monitoring/android/data_collected/#event-specific-attributes
[10]: /real_user_monitoring/explorer/search/#setup-facets-and-measures
[11]: /real_user_monitoring/mobile_and_tv_monitoring/android/setup/#sending-data-when-device-is-offline
[12]: https://github.com/DataDog/dd-sdk-android/blob/eaa15cd344d1723fafaf179fcebf800d6030c6bb/sample/kotlin/src/main/kotlin/com/datadog/android/sample/SampleApplication.kt#L279
[7]: /real_user_monitoring/android/data_collected/#event-specific-attributes
[8]: /real_user_monitoring/mobile_and_tv_monitoring/android/setup/#sending-data-when-device-is-offline
[9]: https://github.com/DataDog/dd-sdk-android/blob/eaa15cd344d1723fafaf179fcebf800d6030c6bb/sample/kotlin/src/main/kotlin/com/datadog/android/sample/SampleApplication.kt#L279
[10]: https://github.com/DataDog/dd-sdk-android/tree/master/sample/kotlin/src/main/kotlin/com/datadog/android/sample/widget
[11]: /real_user_monitoring/mobile_and_tv_monitoring/android/monitoring_app_performance/#time-to-network-settled
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
[12]: https://square.github.io/okhttp/features/events/
Loading
Loading