Skip to content

Commit

Permalink
fix: Ensure extraction of headers from dictionary
Browse files Browse the repository at this point in the history
Signed-off-by: Ferenc Géczi <ferenc.geczi@ibm.com>
  • Loading branch information
Ferenc- committed Aug 8, 2024
1 parent eb5f7bc commit 8fc5428
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/instana/propagators/base_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self):
self._ts = Tracestate()

@staticmethod
def _extract_headers_dict(carrier):
def extract_headers_dict(carrier):
"""
This method converts the incoming carrier into a dict
:param carrier:
Expand Down Expand Up @@ -278,7 +278,7 @@ def extract(self, carrier, disable_w3c_trace_context=False):
"""
try:
traceparent, tracestate = [None] * 2
headers = self._extract_headers_dict(carrier=carrier)
headers = self.extract_headers_dict(carrier=carrier)
if headers is None:
return None
headers = {k.lower(): v for k, v in headers.items()}
Expand Down
11 changes: 7 additions & 4 deletions src/instana/propagators/http_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ def __init__(self):
def inject(self, span_context, carrier, disable_w3c_trace_context=False):
trace_id = span_context.trace_id
span_id = span_context.span_id
# Suppression `level` made in the child context or in the parent context
# has priority over any non-suppressed `level` setting
child_level = int(self.extract_instana_headers(carrier)[2] or "1")
span_context.level = min(child_level, span_context.level)
dictionary_carrier = self.extract_headers_dict(carrier)
if dictionary_carrier:
# Suppression `level` made in the child context or in the parent context
# has priority over any non-suppressed `level` setting
child_level = int(self.extract_instana_headers(dictionary_carrier)[2] or "1")
span_context.level = min(child_level, span_context.level)

serializable_level = str(span_context.level)

if disable_w3c_trace_context:
Expand Down

0 comments on commit 8fc5428

Please sign in to comment.