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

RUMM-2166 Add tracing sampling rate #851

Merged
merged 8 commits into from
May 17, 2022

Conversation

maxep
Copy link
Member

@maxep maxep commented May 12, 2022

What and why?

Offer a configuration option to set the tracing sampling rate. Based on this sampling rate, new network requests will have the x-datadog-sampling-priority header set to 0 (or 1 accordingly), and the trace_id and span_id won’t (or will accordingly) be added to the created RUM Resource.

Note: The x-datadog-sampled is now removed.

When sampled out, a RUM resource appears with no trace:

image

How?

The HTTPHeadersWriter now expect a samplingRate value at initialization. If the rate is 0, the trace id and span id are not propagated to APM nor RUM when instrumenting URLSession. The x-datadog-sampling-priority is set accordingly when a request is intercepted.

The samplingRate is configured by the FeaturesConfiguration.URLSessionAutoInstrumentation and injected to URLSessionInterceptor at initialization.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes

Custom CI job configuration (optional)

  • Run unit tests
  • Run integration tests
  • Run smoke tests

@maxep maxep requested a review from a team as a code owner May 12, 2022 09:27
@maxep maxep force-pushed the maxep/RUMM-2166/apm-sampling branch from cf76409 to a907a6d Compare May 12, 2022 09:32
@maxep
Copy link
Member Author

maxep commented May 12, 2022

I'm targeting the release/1.11.0 branch that was pulled from release/1.11.0-beta2

@maxep maxep force-pushed the maxep/RUMM-2166/apm-sampling branch from a907a6d to ccb8298 Compare May 12, 2022 10:20
@maxep maxep self-assigned this May 12, 2022
@maxep maxep marked this pull request as draft May 12, 2022 14:27
@maxep maxep removed the request for review from a team May 12, 2022 14:27
@maxep maxep force-pushed the maxep/RUMM-2166/apm-sampling branch from ccb8298 to 73fb475 Compare May 12, 2022 15:03
@maxep maxep force-pushed the maxep/RUMM-2166/apm-sampling branch from 73fb475 to 5c9fa6f Compare May 13, 2022 07:33
@maxep maxep marked this pull request as ready for review May 13, 2022 09:04
@maxep maxep requested a review from a team May 13, 2022 09:08
@maxep maxep requested a review from a team as a code owner May 13, 2022 13:37
@maxep maxep force-pushed the maxep/RUMM-2166/apm-sampling branch 2 times, most recently from a776ae2 to 9fde6d7 Compare May 13, 2022 14:04
@maxep maxep force-pushed the maxep/RUMM-2166/apm-sampling branch from 9fde6d7 to 5b7c435 Compare May 13, 2022 15:19
docs/rum_collection/advanced_configuration.md Outdated Show resolved Hide resolved
docs/trace_collection.md Outdated Show resolved Hide resolved
@maxep maxep force-pushed the maxep/RUMM-2166/apm-sampling branch from 4e30ef2 to 7366761 Compare May 16, 2022 07:34
@maxep maxep requested a review from cswatt May 16, 2022 08:49
@maxep maxep force-pushed the maxep/RUMM-2166/apm-sampling branch from 0a1f09d to f8b9787 Compare May 16, 2022 13:43
@maxep maxep requested a review from ncreated May 16, 2022 15:57
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

All good! ✅

@maxep maxep merged commit 32afc19 into release/1.11.0 May 17, 2022
@maxep maxep deleted the maxep/RUMM-2166/apm-sampling branch May 17, 2022 15:10
@ncreated ncreated mentioned this pull request Jul 21, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants