Trace Propagation Cheat Sheet

This is a cheat sheet where you can see how the trace propagation work in SDKs in different scenarios.

SCENARIO:
Incoming trace in sentry-trace/baggage headers
SCENARIO:
Incoming sampled flag in sentry-trace/baggage header
SCENARIO:
traces_propagation_targets are matching?
SCENARIO:
traces_sample_rate setting
OUTCOME:
Send Spans to Sentry?
OUTCOME:
Outgoing Requests Have Trace? (sentry-trace/baggage are present)
OUTCOME:
Continue Incoming Trace? (outgoing trace_id is the incoming trace_id)
not present-yesnullnoyes-
not present-yes0noyes-
not present-yes1yesyes-
--------------------------------------------------------------------------------------------------------------------------------------------
not present-nonullnono-
not present-no0nono-
not present-no1yesno-
--------------------------------------------------------------------------------------------------------------------------------------------
presentempty (deferred)yesnullnoyesyes
presentempty (deferred)yes0noyesyes
presentempty (deferred)yes1yesyesyes
--------------------------------------------------------------------------------------------------------------------------------------------
present1yesnullnoyesyes
present1yes0yesyesyes
present1yes1yesyesyes
--------------------------------------------------------------------------------------------------------------------------------------------
present0yesnullnoyesyes
present0yes0noyesyes
present0yes1noyesyes
--------------------------------------------------------------------------------------------------------------------------------------------
presentempty (deferred)nonullnono-
presentempty (deferred)no0nono-
presentempty (deferred)no1yesno-
--------------------------------------------------------------------------------------------------------------------------------------------
present1nonullnono-
present1no0yesno-
present1no1yesno-
--------------------------------------------------------------------------------------------------------------------------------------------
present0nonullnono-
present0no0nono-
present0no1nono-

Why are we sometimes sampling even if traces_sample_rate is 0? Why are we sometimes unsampling if traces_sample_rate is 1?

A traces_sample_rate between 0 and 1 is only taken into account if there is no incoming trace and the SDK has to make its own sampling decision. If there is an incoming trace, the parent sampling decision always takes precedence over traces_sample_rate.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").