@@ -583,7 +583,11 @@ def get_traceparent(self, *args: "Any", **kwargs: "Any") -> "Optional[str]":
583583 client = self .get_client ()
584584
585585 # If we have an active span, return traceparent from there
586- if has_tracing_enabled (client .options ) and self .span is not None :
586+ if (
587+ has_tracing_enabled (client .options )
588+ and self .span is not None
589+ and not isinstance (self .span , NoOpStreamedSpan )
590+ ):
587591 return self .span ._to_traceparent ()
588592
589593 # else return traceparent from the propagation context
@@ -597,7 +601,11 @@ def get_baggage(self, *args: "Any", **kwargs: "Any") -> "Optional[Baggage]":
597601 client = self .get_client ()
598602
599603 # If we have an active span, return baggage from there
600- if has_tracing_enabled (client .options ) and self .span is not None :
604+ if (
605+ has_tracing_enabled (client .options )
606+ and self .span is not None
607+ and not isinstance (self .span , NoOpStreamedSpan )
608+ ):
601609 return self .span ._to_baggage ()
602610
603611 # else return baggage from the propagation context
@@ -607,7 +615,11 @@ def get_trace_context(self) -> "Dict[str, Any]":
607615 """
608616 Returns the Sentry "trace" context from the Propagation Context.
609617 """
610- if has_tracing_enabled (self .get_client ().options ) and self ._span is not None :
618+ if (
619+ has_tracing_enabled (self .get_client ().options )
620+ and self ._span is not None
621+ and not isinstance (self .span , NoOpStreamedSpan )
622+ ):
611623 return self ._span ._get_trace_context ()
612624
613625 # if we are tracing externally (otel), those values take precedence
0 commit comments