@@ -63,7 +63,7 @@ class SpanExporter:
6363
6464 def export (
6565 self , spans : typing .Sequence [ReadableSpan ]
66- ) -> "SpanExportResult" :
66+ ) -> "SpanExportResult" : # pyright: ignore[reportReturnType]
6767 """Exports a batch of telemetry data.
6868
6969 Args:
@@ -79,7 +79,7 @@ def shutdown(self) -> None:
7979 Called when the SDK is shut down.
8080 """
8181
82- def force_flush (self , timeout_millis : int = 30000 ) -> bool :
82+ def force_flush (self , timeout_millis : int = 30000 ) -> bool : # pyright: ignore[reportReturnType]
8383 """Hint to ensure that the export of any spans the exporter has received
8484 prior to the call to ForceFlush SHOULD be completed as soon as possible, preferably
8585 before returning from this method.
@@ -102,7 +102,7 @@ def on_start(
102102 pass
103103
104104 def on_end (self , span : ReadableSpan ) -> None :
105- if not span .context . trace_flags .sampled :
105+ if not ( span .context and span . context . trace_flags .sampled ) :
106106 return
107107 token = attach (set_value (_SUPPRESS_INSTRUMENTATION_KEY , True ))
108108 try :
@@ -188,7 +188,7 @@ def on_start(
188188 pass
189189
190190 def on_end (self , span : ReadableSpan ) -> None :
191- if not span .context . trace_flags .sampled :
191+ if not ( span .context and span . context . trace_flags .sampled ) :
192192 return
193193 self ._batch_processor .emit (span )
194194
0 commit comments