Skip to content

Commit fb11756

Browse files
committed
fix: fixed reading suppression header from message's headers
Signed-off-by: Cagri Yonca <[email protected]>
1 parent d412bd7 commit fb11756

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/instana/instrumentation/kafka/kafka_python.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def trace_kafka_send(
5151

5252
# context propagation
5353
headers = kwargs.get("headers", [])
54+
if not is_suppressed and ("x_instana_l_s", b"0") in headers:
55+
is_suppressed = True
56+
5457
suppression_header = {"x_instana_l_s": "0" if is_suppressed else "1"}
5558
headers.append(suppression_header)
5659

@@ -96,10 +99,8 @@ def create_span(
9699
)
97100

98101
if not is_suppressed and headers:
99-
for header_name, header_value in headers:
100-
if header_name == "x_instana_l_s" and header_value == b"0":
101-
is_suppressed = True
102-
break
102+
if ("x_instana_l_s", b"0") in headers:
103+
is_suppressed = True
103104

104105
if is_suppressed:
105106
return

0 commit comments

Comments
 (0)