-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Android and iOS Application Profiling in RUM #34078
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
Conversation
…ate RUM with Other Telemetry.
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
| .setApplicationLaunchSampleRate() // default is 15% | ||
| .build.() | ||
|
|
||
| Profiling.enable(profilingConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Profiling.enable(profilingConfig) | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { | |
| Profiling.enable(profilingConfig) | |
| } |
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
| 2. Initialize the RUM SDK and configure the `profilingMaximumRate`, which sets the maximum percentage of sessions that are profiled. | ||
|
|
||
| <div class="alert alert-danger"> | ||
| If no value is specified, the default <code>profilingMaximumRate</code> is 15 percent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If no value is specified, the default <code>profilingMaximumRate</code> is 15 percent. | |
| If no value is specified, the default <code>applicationLaunchSampleRate</code> is 15 percent. |
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/ios_profiling.md
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/ios_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/ios_profiling.md
Outdated
Show resolved
Hide resolved
|
Created DOCS-13195 to track docs team review |
rtrieu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for this great PR! left a lot of feedback around:
- relative URLs
- consistent tense
- header styling
- conciseness in some places
- additional context in other places
let me know if you have any questions about my feedback. happy to chat!
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/ios_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/ios_profiling.md
Outdated
Show resolved
Hide resolved
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/ios_profiling.md
Outdated
Show resolved
Hide resolved
| ) | ||
|
|
||
| // Enable Profiling feature | ||
| Profiling.enable(with: .init()) // default is 5% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Profiling.enable(with: .init()) // default is 5% | |
| Profiling.enable(with: .init()) // default is 15% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS has a different sample rate of 5%
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would simplify or go with the example in the google docs
| Profiling.enable(with: .init()) // default is 5% | |
| Profiling.enable() // default is 5% |
or
| Profiling.enable(with: .init()) // default is 5% | |
| Profiling.enable(with: .init(applicationLaunchSampleRate: 5)) // custom sample rate (overrides the default 5%) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah apologies, thought this was a typo because i saw 15 in another place
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/ios_profiling.md
Outdated
Show resolved
Hide resolved
|
|
||
| {{< img src="real_user_monitoring/ios/ios-profiling-session.png" alt="iOS profiling data in a view event to initial display vital event." style="width:90%;" >}} | ||
|
|
||
| Use the flame graph, thread timeline, and call graph visualizations to analyze the profiling data for the time to initial display. You can also download the profiling data for external analysis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Use the flame graph, thread timeline, and call graph visualizations to analyze the profiling data for the time to initial display. You can also download the profiling data for external analysis. | |
| Use the flame graph to identify which functions consume the most Wall time during launch, the thread timeline to see parallel execution patterns, and the call graph to trace function dependencies. You can also download the profiling data for external analysis or deeper investigation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rtrieu iOS Profiling measures Wall time instead of CPU time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simaoseica-dd thanks, updated suggestion
rtrieu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for this great PR! left a lot of feedback around:
- relative URLs
- consistent tense
- header styling
- conciseness in some places
- additional context in other places
let me know if you have any questions about my feedback. happy to chat!
Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>
Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>
0xnm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few suggestions, lgtm.
|
|
||
| <div class="alert alert-warning">The total volume of profiles may not match the percentage configured in <code>applicationLaunchSampleRate</code>. This variation results from <a href="https://developer.android.com/topic/performance/tracing/profiling-manager/will-my-profile-always-be-collected#how-rate-limiting-works">rate limitations</a> within the data collector, including profiling support on older devices and the maximum profiling frequency per device.</div> | ||
|
|
||
| The [ProfilingManager API][4] also supports disablng rate limiting during debug builds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The [ProfilingManager API][4] also supports disablng rate limiting during debug builds. | |
| The [ProfilingManager API][4] also supports disabling rate limiting during debug builds. |
| [4]: /real_user_monitoring/application_monitoring/ios/application_launch_monitoring?tab=swift | ||
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [4]: /real_user_monitoring/application_monitoring/ios/application_launch_monitoring?tab=swift | |
| [4]: /real_user_monitoring/application_monitoring/ios/application_launch_monitoring?tab=swift | |
| class SampleApplication : Application() { | ||
| override fun onCreate() { | ||
| super.onCreate() | ||
| val configuration = Configuration.Builder( | ||
| clientToken = "<CLIENT_TOKEN>", | ||
| env = "<ENV_NAME>", | ||
| variant = "<APP_VARIANT_NAME>" | ||
| ).build() | ||
|
|
||
| Datadog.initialize(this, configuration, trackingConsent) | ||
|
|
||
| // Enable RUM (required for Profiling) | ||
| val rumConfig = RumConfiguration.Builder(applicationId) | ||
| .build() | ||
| Rum.enable(rumConfig) | ||
|
|
||
| // Enable Profiling | ||
| val profilingConfig = ProfilingConfiguration.Builder() | ||
| .setApplicationLaunchSampleRate(15) // default is 15% | ||
| .build() | ||
|
|
||
| Profiling.enable(profilingConfig) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| class SampleApplication : Application() { | |
| override fun onCreate() { | |
| super.onCreate() | |
| val configuration = Configuration.Builder( | |
| clientToken = "<CLIENT_TOKEN>", | |
| env = "<ENV_NAME>", | |
| variant = "<APP_VARIANT_NAME>" | |
| ).build() | |
| Datadog.initialize(this, configuration, trackingConsent) | |
| // Enable RUM (required for Profiling) | |
| val rumConfig = RumConfiguration.Builder(applicationId) | |
| .build() | |
| Rum.enable(rumConfig) | |
| // Enable Profiling | |
| val profilingConfig = ProfilingConfiguration.Builder() | |
| .setApplicationLaunchSampleRate(15) // default is 15% | |
| .build() | |
| Profiling.enable(profilingConfig) | |
| } | |
| } | |
| class SampleApplication : Application() { | |
| override fun onCreate() { | |
| super.onCreate() | |
| val configuration = Configuration.Builder( | |
| clientToken = "<CLIENT_TOKEN>", | |
| env = "<ENV_NAME>", | |
| variant = "<APP_VARIANT_NAME>" | |
| ).build() | |
| Datadog.initialize(this, configuration, trackingConsent) | |
| // Enable RUM (required for Profiling) | |
| val rumConfig = RumConfiguration.Builder(applicationId) | |
| .build() | |
| Rum.enable(rumConfig) | |
| // Enable Profiling | |
| val profilingConfig = ProfilingConfiguration.Builder() | |
| .setApplicationLaunchSampleRate(15) // default is 15% | |
| .build() | |
| Profiling.enable(profilingConfig) | |
| } | |
| } |
we can reduce indent
| Profiling.enable(profilingConfig) | ||
| } | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two spaces before can be removed
|
|
||
| // Enable Profiling feature | ||
| Profiling.enable(with: .init()) // default is 5% | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two spaces before can be removed
| import DatadogCore | ||
| import DatadogRUM | ||
| import DatadogProfiling | ||
|
|
||
| // Initialize Datadog SDK with your configuration | ||
| Datadog.initialize( | ||
| with: Datadog.Configuration( | ||
| clientToken: "<client token>", // From Datadog UI | ||
| env: "<environment>", // for example, "production", "staging" | ||
| service: "<service name>" // Your app's service name | ||
| ), | ||
| trackingConsent: trackingConsent // GDPR compliance setting | ||
| ) | ||
|
|
||
| // Enable RUM feature | ||
| RUM.enable( | ||
| with: RUM.Configuration( | ||
| applicationID: "<rum application id>" | ||
| ) | ||
| ) | ||
|
|
||
| // Enable Profiling feature | ||
| Profiling.enable(with: .init()) // default is 5% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import DatadogCore | |
| import DatadogRUM | |
| import DatadogProfiling | |
| // Initialize Datadog SDK with your configuration | |
| Datadog.initialize( | |
| with: Datadog.Configuration( | |
| clientToken: "<client token>", // From Datadog UI | |
| env: "<environment>", // for example, "production", "staging" | |
| service: "<service name>" // Your app's service name | |
| ), | |
| trackingConsent: trackingConsent // GDPR compliance setting | |
| ) | |
| // Enable RUM feature | |
| RUM.enable( | |
| with: RUM.Configuration( | |
| applicationID: "<rum application id>" | |
| ) | |
| ) | |
| // Enable Profiling feature | |
| Profiling.enable(with: .init()) // default is 5% | |
| import DatadogCore | |
| import DatadogRUM | |
| import DatadogProfiling | |
| // Initialize Datadog SDK with your configuration | |
| Datadog.initialize( | |
| with: Datadog.Configuration( | |
| clientToken: "<client token>", // From Datadog UI | |
| env: "<environment>", // for example, "production", "staging" | |
| service: "<service name>" // Your app's service name | |
| ), | |
| trackingConsent: trackingConsent // GDPR compliance setting | |
| ) | |
| // Enable RUM feature | |
| RUM.enable( | |
| with: RUM.Configuration( | |
| applicationID: "<rum application id>" | |
| ) | |
| ) | |
| // Enable Profiling feature | |
| Profiling.enable(with: .init()) // default is 5% |
| ) | ||
|
|
||
| // Enable Profiling feature | ||
| Profiling.enable(with: .init()) // default is 5% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS has a different sample rate of 5%
| ) | ||
|
|
||
| // Enable Profiling feature | ||
| Profiling.enable(with: .init()) // default is 5% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would simplify or go with the example in the google docs
| Profiling.enable(with: .init()) // default is 5% | |
| Profiling.enable() // default is 5% |
or
| Profiling.enable(with: .init()) // default is 5% | |
| Profiling.enable(with: .init(applicationLaunchSampleRate: 5)) // custom sample rate (overrides the default 5%) |
|
|
||
| ## Overview | ||
|
|
||
| iOS profiling captures detailed data about your application's performance during launch, helping you identify slow functions and optimize startup time. iOS profiling is built on top of the [mach Kernel API][1] and samples all application threads to collect call stacks for all application processes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "...for all application processes" is confusing
| iOS profiling captures detailed data about your application's performance during launch, helping you identify slow functions and optimize startup time. iOS profiling is built on top of the [mach Kernel API][1] and samples all application threads to collect call stacks for all application processes. | |
| iOS profiling captures detailed data about your application's performance during launch, helping you identify slow functions and optimize startup time. iOS profiling is built on top of the [mach Kernel API][1] and periodically samples all application threads to collect call stacks. |
|
|
||
| {{< img src="real_user_monitoring/ios/ios-profiling-session.png" alt="iOS profiling data in a view event to initial display vital event." style="width:90%;" >}} | ||
|
|
||
| Use the flame graph, thread timeline, and call graph visualizations to analyze the profiling data for the time to initial display. You can also download the profiling data for external analysis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rtrieu iOS Profiling measures Wall time instead of CPU time
content/en/real_user_monitoring/correlate_with_other_telemetry/profiling/android_profiling.md
Show resolved
Hide resolved
rtrieu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few more tiny suggestions!
What does this PR do? What is the motivation?
Added 2 new pages about Android and iOS application profiling under the "Profiling" section of "Correlate RUM with Other Telemetry".
New pages introduced are:
Additionally, browser profiling has moved one layer down in the documentation:
Merge instructions
Merge readiness:
For Datadog employees:
Your branch name MUST follow the
<name>/<description>convention and include the forward slash (/). Without this format, your pull request will not pass CI, the GitLab pipeline will not run, and you won't get a branch preview. Getting a branch preview makes it easier for us to check any issues with your PR, such as broken links.If your branch doesn't follow this format, rename it or create a new branch and PR.
[6/5/2025] Merge queue has been disabled on the documentation repo. If you have write access to the repo, the PR has been reviewed by a Documentation team member, and all of the required checks have passed, you can use the Squash and Merge button to merge the PR. If you don't have write access, or you need help, reach out in the #documentation channel in Slack.
Additional notes