-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propagation:Ensure W3C tracestate
is always propagated
#3255
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Codecov Report
@@ Coverage Diff @@
## master #3255 +/- ##
=======================================
Coverage 98.21% 98.22%
=======================================
Files 1253 1253
Lines 72110 72198 +88
Branches 3346 3350 +4
=======================================
+ Hits 70823 70916 +93
+ Misses 1287 1282 -5
... and 4 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
# @param field_value_pairs [Hash<String>] the fields to be overwritten | ||
# @return [TraceDigest] returns a copy of this object with the `field_value_pairs` modified | ||
def merge(field_value_pairs) | ||
# DEV: Because we want to sometimes freeze the values provided to `TraceDigest`, it's best |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking: Is there any reason to be concerned about performance here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really performance, but more about maintainability.
This code section would have to be duplicated here:
dd-trace-rb/lib/datadog/tracing/trace_digest.rb
Lines 122 to 140 in 8b6432a
@span_id = span_id | |
@span_name = span_name && span_name.dup.freeze | |
@span_resource = span_resource && span_resource.dup.freeze | |
@span_service = span_service && span_service.dup.freeze | |
@span_type = span_type && span_type.dup.freeze | |
@trace_distributed_tags = trace_distributed_tags && trace_distributed_tags.dup.freeze | |
@trace_hostname = trace_hostname && trace_hostname.dup.freeze | |
@trace_id = trace_id | |
@trace_name = trace_name && trace_name.dup.freeze | |
@trace_origin = trace_origin && trace_origin.dup.freeze | |
@trace_process_id = trace_process_id | |
@trace_resource = trace_resource && trace_resource.dup.freeze | |
@trace_runtime_id = trace_runtime_id && trace_runtime_id.dup.freeze | |
@trace_sampling_priority = trace_sampling_priority | |
@trace_service = trace_service && trace_service.dup.freeze | |
@trace_distributed_id = trace_distributed_id | |
@trace_flags = trace_flags | |
@trace_state = trace_state && trace_state.dup.freeze | |
@trace_state_unknown_fields = trace_state_unknown_fields && trace_state_unknown_fields.dup.freeze |
But it has to decide which fields can be used as is, or which ones need to be
dup.freeze
.
This is just to make sure we don't duplicate the logic and forget to copy some values but not others.
What does this PR do?
This PR ensures that the
tracestate
header received, even if not part of the first valid propagation style, is still propagated downstream. This respects the spec fortracestate
, which states:This is only an issue when W3C extraction style is proceeded by another style. And this is currently the default (
Datadog,tracecontext
).Now with this change, when Datadog headers match, we will now continue searching for
tracecontext
headers to enrich the downstream propagation context.Additional Notes:
This PR also introduces the
DD_TRACE_PROPAGATION_EXTRACT_FIRST
configuration, to allow users to restore the prior behavior of not inspecting any headers after the first one was extracted.How to test the change?
All changes are covered by unit tests and system-tests (DataDog/system-tests#1795).
For Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!