Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c772bb7

Browse files
author
alrex
authored
fix: b3 propagation needs to check if parent is SpanContext (open-telemetry#621)
1 parent d01d779 commit c772bb7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/trace/propagation/b3_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def inject(
137137
set_in_carrier(
138138
carrier,
139139
self.PARENT_SPAN_ID_KEY,
140-
format_span_id(span.parent.context.span_id),
140+
format_span_id(span.parent.span_id),
141141
)
142142
set_in_carrier(carrier, self.SAMPLED_KEY, "1" if sampled else "0")
143143

opentelemetry-sdk/tests/trace/propagation/test_b3_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_child_parent_new_carrier(old_carrier):
4545
trace_flags=parent_context.trace_flags,
4646
trace_state=parent_context.trace_state,
4747
),
48-
parent=parent,
48+
parent=parent.get_context(),
4949
)
5050

5151
new_carrier = {}

0 commit comments

Comments
 (0)