In our app, we have automatic network tracking/tracing enabled, but also send a few custom traces. We apply the trace sample rate in several places in the Datadog setup (shortened for brevity):
We noticed in production that some of our custom traces show up much more often than others and suspected an issue with the sampling rate.
Reproduction steps
We were able to track it down by setting the sample rate to 0 (in our debug environment), and could see that a few traces always come through regardless. It turns out all custom traces with a parent trace are affected, regardless if we set the parent explicitly or Datadog detects it automatically. So, in pseudocode:
Describe the bug
In our app, we have automatic network tracking/tracing enabled, but also send a few custom traces. We apply the trace sample rate in several places in the Datadog setup (shortened for brevity):
We noticed in production that some of our custom traces show up much more often than others and suspected an issue with the sampling rate.
Reproduction steps
We were able to track it down by setting the sample rate to 0 (in our debug environment), and could see that a few traces always come through regardless. It turns out all custom traces with a parent trace are affected, regardless if we set the parent explicitly or Datadog detects it automatically. So, in pseudocode:
…would lead to
trace2
escaping the downsampling.…whereas this works as expected – given a sample rate of 0, neither of them would be sent.
SDK logs
-
Expected behavior
The trace sample rate should govern all traces to effectively limit cost.
We will need to disable custom traces entirely until this is fixed because it produces costs we cannot control, so we hope for a quick solution.
Affected SDK versions
2.14.2 - 2.17.0
Latest working SDK version
unknown
Did you confirm if the latest SDK version fixes the bug?
Yes
Integration Methods
SPM
Xcode Version
Xcode 15.4
Swift Version
Swift 5.9
MacOS Version
macOS Sonoma 14.7 (23H124)
Deployment Target
iOS 16
Device Information
Reproduces in simulators and devices
Other relevant information
No response