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-1579 Inject sampling headers to instrumented requests #575

Conversation

ncreated
Copy link
Member

@ncreated ncreated commented Aug 27, 2021

What and why?

🐞 This PR aligns our trace propagation logic with "How are RUM resources linked to traces?" doc by adding two more headers to instrumented requests:

x-datadog-sampling-priority: 1 
x-datadog-sampled: 1

As reported in #572, lack of these headers may lead to not connecting mobile and backend trace in distributed tracing. The issue is hard to reproduce in our own infra, as we seem to overwrite sampling rules. In this fix I'm basing on docs, customer observation and my research on other DD SDKs implementation (including browser-sdk that respects those headers).

This PR targets the 1.7.0-beta4 branch made for next release. Once merged, I will raise another PR to update master with this fix from 1.7.0-beta4.

How?

I added these 2 headers to HTTPHeadersWriter which is used internally for headers injection. I did necessary update to unit tests and integration tests (both for Swift URLSession and Obj-c NSURLSession auto-instrumentation in RUM and Tracing).

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

Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

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

Nice work 👏 I have a non-blocking question.

@ncreated ncreated merged commit cbd2249 into release/1.7.0-beta4 Aug 31, 2021
@ncreated ncreated deleted the ncreated/RUMM-1579-inject-sampling-headers-when-propagating-trace branch August 31, 2021 14:33
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