03 Feb 2025
05:26 PM
- last edited on
10 Feb 2025
10:09 AM
by
MaciejNeumann
Hello,
I’m using Dynatrace to monitor HTTP calls in an iOS app with the SDK you’ve provided.
I’ve noticed that while the “x-dynatrace” header is added to most of the HTTP calls made by the app, it doesn’t appear on all of them. It seems that at some point during execution, the SDK stops attaching this header to subsequent calls.
However, I observed that when I set the sampling rate to 100% via the dashboard, the “x-dynatrace” header is consistently included in all calls.
Is there a correlation between the sampling rate and this behavior? If so, how does the sampling rate influence the inclusion of this header?
Looking forward to your insights.
10 Feb 2025 10:49 AM
Currently setting x-dynatrace is not related to capture percentage. But it won't be set if capturing was turned off for some reason (via configuration or when agent stopped capturing as it could not reach beacon endpoint to get a configuration)
12 Feb 2025 10:12 AM
Hi Patrick, thanks for the reply.
I’m not quite sure if we should expect the Dynatrace header to appear in all calls (so the fact that it’s missing in many of them without an apparent reason is a concern we should worry about) or if it’s just normal behavior (and in that case, the SDK decides whether or not to monitor a network call).
What happens is that with 100% capture on the dashboard, it seems to always be there.
With the setting at 1%, though, the behavior seems unpredictable; of course, we never set 100% because it doesn't make sense to monitor the entire user base.
The funny thing is that on the Android SDK, this header is always present.
Could it be due to some incompatibility with other libraries that use URLProtocol to hook into the network layer?
If that's the case, is there a manual way to obtain the header and attach it manually to a single URLRequest?
12 Feb 2025 01:08 PM
If you feel the agent misses setting a header when it should please create a support request with foll agent logs or a reproducer app.