Skip to content

Commit eb5f7bc

Browse files
committed
fix: Prioritize trace level from current context
Signed-off-by: Ferenc Géczi <[email protected]>
1 parent ccf0e09 commit eb5f7bc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/instana/propagators/base_propagator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def __determine_span_context(self, trace_id, span_id, level, synthetic, tracepar
207207

208208
return ctx
209209

210-
def __extract_instana_headers(self, dc):
210+
def extract_instana_headers(self, dc):
211211
"""
212212
Search carrier for the *HEADER* keys and return the tracing key-values
213213
@@ -283,7 +283,7 @@ def extract(self, carrier, disable_w3c_trace_context=False):
283283
return None
284284
headers = {k.lower(): v for k, v in headers.items()}
285285

286-
trace_id, span_id, level, synthetic = self.__extract_instana_headers(dc=headers)
286+
trace_id, span_id, level, synthetic = self.extract_instana_headers(dc=headers)
287287
if not disable_w3c_trace_context:
288288
traceparent, tracestate = self.__extract_w3c_trace_context_headers(dc=headers)
289289

src/instana/propagators/http_propagator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def __init__(self):
2020
def inject(self, span_context, carrier, disable_w3c_trace_context=False):
2121
trace_id = span_context.trace_id
2222
span_id = span_context.span_id
23+
# Suppression `level` made in the child context or in the parent context
24+
# has priority over any non-suppressed `level` setting
25+
child_level = int(self.extract_instana_headers(carrier)[2] or "1")
26+
span_context.level = min(child_level, span_context.level)
2327
serializable_level = str(span_context.level)
2428

2529
if disable_w3c_trace_context:

0 commit comments

Comments
 (0)