-
Notifications
You must be signed in to change notification settings - Fork 651
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
Fixed B3 Propagator #1750
Fixed B3 Propagator #1750
Conversation
ed76e66
to
fba4e61
Compare
@@ -97,6 +97,8 @@ def extract( | |||
or self._trace_id_regex.fullmatch(trace_id) is None | |||
or self._span_id_regex.fullmatch(span_id) is None | |||
): | |||
if context is None: | |||
return trace.set_span_in_context(trace.INVALID_SPAN, context) | |||
return context |
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.
This should also fix the composite propagator issue. While you are at it, could you also fix another issue with B3 when there is a valid propagation header. context
should be passed in this set_span_in_context
call.
Lines 114 to 125 in fba4e61
return trace.set_span_in_context( | |
trace.NonRecordingSpan( | |
trace.SpanContext( | |
# trace an span ids are encoded in hex, so must be converted | |
trace_id=trace_id, | |
span_id=span_id, | |
is_remote=True, | |
trace_flags=trace.TraceFlags(options), | |
trace_state=trace.TraceState(), | |
) | |
) | |
) |
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.
Done. Also added tests to ensure the returned context is always derived from the provided one.
B3 propagator was returning `None` instead of invalid context after last change. This resulted in many apps crashing when B3 failed to extract a valid context from carrier. This PR patches it to not make apps crash and return an invalid context when one cannot be extracted from the carrier.
Description
B3 propagator was returning
None
instead of invalid context after lastchange. This resulted in many apps crashing when B3 failed to extract a
valid context from carrier. This PR patches it to not make apps crash
and return an invalid context when one cannot be extracted from the
carrier.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: