Skip to content

Commit 039b30b

Browse files
author
saville
committed
Use span.is_recording() for check
1 parent af324dd commit 039b30b

File tree

1 file changed

+2
-2
lines changed
  • propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger

1 file changed

+2
-2
lines changed

propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def inject(
8181
if span_context == trace.INVALID_SPAN_CONTEXT:
8282
return
8383

84-
# NonRecordingSpans do not have a parent, set parent to 0 in this case
85-
span_parent_id = span.parent.span_id if hasattr(span, 'parent') and span.parent else 0
84+
# Non-recording spans do not have a parent
85+
span_parent_id = span.parent.span_id if span.is_recording() and span.parent else 0
8686
trace_flags = span_context.trace_flags
8787
if trace_flags.sampled:
8888
trace_flags |= self.DEBUG_FLAG

0 commit comments

Comments
 (0)