cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Header and Sampling Behavior with iOS SDK

marcodg
Newcomer

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.

3 REPLIES 3

Patrick_H
Dynatrace Leader
Dynatrace Leader

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)

iOS help: https://www.dynatrace.com/support/help/shortlink/ios-hub

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?
 

  • iOS and Android instrumentation cannot always be exactly teh same because of different technical limitations
  • what is the use-case for checking for the x-dynatrace header? this is only needed for linking service calls if backend is instrumented
  • if other libraries also swizzle request methods id could happen that the agent fails to set the header correctly, but usually swizzling issues cause more sever problems like crashes
  • if the agent does not capture data, then it is irrelevant if the request have the x-dynatrace header or not as it can't be linked to a service call if there is no request event from agent

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.

iOS help: https://www.dynatrace.com/support/help/shortlink/ios-hub

Featured Posts