Fix opentracing inject to use the SpanContext, not the Span (#10074)
Signed-off-by: Brad Murray brad@beeper.com
This commit is contained in:
parent
ed53bf314f
commit
10e6d2abce
|
@ -0,0 +1 @@
|
||||||
|
Update opentracing to inject the right context into the carrier.
|
|
@ -594,7 +594,7 @@ def inject_active_span_twisted_headers(headers, destination, check_destination=T
|
||||||
|
|
||||||
span = opentracing.tracer.active_span
|
span = opentracing.tracer.active_span
|
||||||
carrier = {} # type: Dict[str, str]
|
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():
|
for key, value in carrier.items():
|
||||||
headers.addRawHeaders(key, value)
|
headers.addRawHeaders(key, value)
|
||||||
|
@ -631,7 +631,7 @@ def inject_active_span_byte_dict(headers, destination, check_destination=True):
|
||||||
span = opentracing.tracer.active_span
|
span = opentracing.tracer.active_span
|
||||||
|
|
||||||
carrier = {} # type: Dict[str, str]
|
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():
|
for key, value in carrier.items():
|
||||||
headers[key.encode()] = [value.encode()]
|
headers[key.encode()] = [value.encode()]
|
||||||
|
@ -665,7 +665,7 @@ def inject_active_span_text_map(carrier, destination, check_destination=True):
|
||||||
return
|
return
|
||||||
|
|
||||||
opentracing.tracer.inject(
|
opentracing.tracer.inject(
|
||||||
opentracing.tracer.active_span, opentracing.Format.TEXT_MAP, carrier
|
opentracing.tracer.active_span.context, opentracing.Format.TEXT_MAP, carrier
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ def get_active_span_text_map(destination=None):
|
||||||
|
|
||||||
carrier = {} # type: Dict[str, str]
|
carrier = {} # type: Dict[str, str]
|
||||||
opentracing.tracer.inject(
|
opentracing.tracer.inject(
|
||||||
opentracing.tracer.active_span, opentracing.Format.TEXT_MAP, carrier
|
opentracing.tracer.active_span.context, opentracing.Format.TEXT_MAP, carrier
|
||||||
)
|
)
|
||||||
|
|
||||||
return carrier
|
return carrier
|
||||||
|
@ -702,7 +702,7 @@ def active_span_context_as_string():
|
||||||
carrier = {} # type: Dict[str, str]
|
carrier = {} # type: Dict[str, str]
|
||||||
if opentracing:
|
if opentracing:
|
||||||
opentracing.tracer.inject(
|
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)
|
return json_encoder.encode(carrier)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue