Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix opentracing inject to use the SpanContext, not the Span #10074

Merged
merged 2 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10074.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update opentracing to inject the right context into the carrier.
10 changes: 5 additions & 5 deletions synapse/logging/opentracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def inject_active_span_twisted_headers(headers, destination, check_destination=T

span = opentracing.tracer.active_span
carrier = {} # type: Dict[str, str]
opentracing.tracer.inject(span, opentracing.Format.HTTP_HEADERS, carrier)
opentracing.tracer.inject(span.context, opentracing.Format.HTTP_HEADERS, carrier)

for key, value in carrier.items():
headers.addRawHeaders(key, value)
Expand Down Expand Up @@ -625,7 +625,7 @@ def inject_active_span_byte_dict(headers, destination, check_destination=True):
span = opentracing.tracer.active_span

carrier = {} # type: Dict[str, str]
opentracing.tracer.inject(span, opentracing.Format.HTTP_HEADERS, carrier)
opentracing.tracer.inject(span.context, opentracing.Format.HTTP_HEADERS, carrier)

for key, value in carrier.items():
headers[key.encode()] = [value.encode()]
Expand Down Expand Up @@ -659,7 +659,7 @@ def inject_active_span_text_map(carrier, destination, check_destination=True):
return

opentracing.tracer.inject(
opentracing.tracer.active_span, opentracing.Format.TEXT_MAP, carrier
opentracing.tracer.active_span.context, opentracing.Format.TEXT_MAP, carrier
)


Expand All @@ -681,7 +681,7 @@ def get_active_span_text_map(destination=None):

carrier = {} # type: Dict[str, str]
opentracing.tracer.inject(
opentracing.tracer.active_span, opentracing.Format.TEXT_MAP, carrier
opentracing.tracer.active_span.context, opentracing.Format.TEXT_MAP, carrier
)

return carrier
Expand All @@ -696,7 +696,7 @@ def active_span_context_as_string():
carrier = {} # type: Dict[str, str]
if opentracing:
opentracing.tracer.inject(
opentracing.tracer.active_span, opentracing.Format.TEXT_MAP, carrier
opentracing.tracer.active_span.context, opentracing.Format.TEXT_MAP, carrier
)
return json_encoder.encode(carrier)

Expand Down