Skip to content

Best practices for native iOS Android tracing #30238

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

rtrieu
Copy link
Contributor

@rtrieu rtrieu commented Jul 1, 2025

What does this PR do? What is the motivation?

Adds a new RUM guide about best practices for tracing native iOS and Android apps.

Merge instructions

Merge readiness:

  • Ready for merge

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

@rtrieu rtrieu requested review from a team as code owners July 1, 2025 19:30
@rtrieu rtrieu added the WORK IN PROGRESS No review needed, it's a wip ;) label Jul 1, 2025
@github-actions github-actions bot added the Guide Content impacting a guide label Jul 1, 2025
Copy link
Contributor

github-actions bot commented Jul 1, 2025

📝 Documentation Team Review Required

This pull request requires approval from the @DataDog/documentation team before it can be merged.

Please ensure your changes follow our documentation guidelines and wait for a team member to review and approve your changes.

Copy link
Contributor

github-actions bot commented Jul 1, 2025

rtrieu and others added 4 commits July 15, 2025 13:31
@rtrieu rtrieu requested review from plousada and MaelNamNam July 16, 2025 15:03
@rtrieu rtrieu removed the WORK IN PROGRESS No review needed, it's a wip ;) label Jul 16, 2025
@hestonhoffman hestonhoffman added the editorial review Waiting on a more in-depth review label Jul 16, 2025
Copy link
Contributor

@MaelNamNam MaelNamNam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor change + a doubt to clarify. Otherwise LGTM. Thanks!


Sampling affects different types of spans you create in your mobile app:

- **Local span sampling** applies to manually instrumented spans (like business spans or performance profiling spans). It's controlled by the `Trace.sampleRate` parameter. For example, if you set this rate to 50, all manually created spans are sent to Datadog, but only 50% are visible in the UI. Each span event includes the `_dd.agent_psr` field (the sampling rate) and `metrics._sampling_priority_v1` (1 for sampled, 0 for not sampled).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Local span sampling** applies to manually instrumented spans (like business spans or performance profiling spans). It's controlled by the `Trace.sampleRate` parameter. For example, if you set this rate to 50, all manually created spans are sent to Datadog, but only 50% are visible in the UI. Each span event includes the `_dd.agent_psr` field (the sampling rate) and `metrics._sampling_priority_v1` (1 for sampled, 0 for not sampled).
- **Local span sampling** applies to manually instrumented spans (like performance profiling spans). It's controlled by the `Trace.sampleRate` parameter. For example, if you set this rate to 50, all manually created spans are sent to Datadog, but only 50% are visible in the UI. Each span event includes the `_dd.agent_psr` field (the sampling rate) and `metrics._sampling_priority_v1` (1 for sampled, 0 for not sampled).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plousada about

For example, if you set this rate to 50, all manually created spans are sent to Datadog, but only 50% are visible in the UI.

Isn't it rather

For example, if you set this rate to 50, the Trace SDK will produce spans in 50% of the cases, and send all of those to Datadog. Visibility of those spans in the UI will depend on your APM retention filters.

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial review Waiting on a more in-depth review Guide Content impacting a guide
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants