fix(span_links): ensures trace_flags is consistent with the sampling priority #3596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Currently the
SpanLink.trace_flags
is set usingTraceDigest.trace_flags
. Thetrace_flag
field in a trace_digest store sampling decisions propagated by tracecontext distributed headers. Therefore for non-remote spans and spans generated via datadog/b3 distributed tracing headers will have atrace_flag
ofnil
even when a sampling decision exists.SpanLink.trace_flag
must have one of the following values:nil
If there is NO sampling decision on the linked span1
If the linked span is sampled0
If the linked span is NOT sampled (span will be dropped by the agent)Since trace_flag is ONLY a function of sampling priority, we can ignore
TraceDigest.trace_flags
and always use sampling_priority to compute the valid when a span link is generated.