File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,7 +121,10 @@ def start_span(
121121 ) -> InstanaSpan :
122122 # Extract span_context from context if needed (OpenTelemetry API compliance)
123123 if context is not None and span_context is None :
124- span_context = otel_get_current_span (context ).get_span_context () # type: ignore[assignment]
124+ otel_ctx = otel_get_current_span (context ).get_span_context ()
125+ if isinstance (otel_ctx , SpanContext ):
126+ span_context = otel_ctx
127+
125128
126129 parent_context = (
127130 span_context if span_context else instana_get_current_span ().get_span_context ()
@@ -159,7 +162,9 @@ def start_as_current_span(
159162 ) -> Iterator [InstanaSpan ]:
160163 # Extract span_context from context if needed (OpenTelemetry API compliance)
161164 if context is not None and span_context is None :
162- span_context = otel_get_current_span (context ).get_span_context () # type: ignore[assignment]
165+ otel_ctx = otel_get_current_span (context ).get_span_context ()
166+ if isinstance (otel_ctx , SpanContext ):
167+ span_context = otel_ctx
163168
164169 # Pass both context and span_context - the guard in start_span prevents redundant extraction
165170 span = self .start_span (
You can’t perform that action at this time.
0 commit comments