@@ -87,15 +87,13 @@ def test_on_new_span_on_close(
8787 with sentry_sdk .traces .start_span (name = "custom parent" ):
8888 rust_tracing .new_span (RustTracingLevel .Info , 3 )
8989
90- sentry_first_rust_span = sentry_sdk .traces ._get_current_streamed_span ()
90+ sentry_first_rust_span = sentry_sdk .traces .get_current_span ()
9191 rust_first_rust_span = rust_tracing .spans [3 ]
9292
9393 assert sentry_first_rust_span == rust_first_rust_span
9494
9595 rust_tracing .close_span (3 )
96- assert (
97- sentry_sdk .traces ._get_current_streamed_span () != sentry_first_rust_span
98- )
96+ assert sentry_sdk .traces .get_current_span () != sentry_first_rust_span
9997
10098 sentry_sdk .flush ()
10199 spans = [item .payload for item in items if item .type == "span" ]
@@ -173,32 +171,30 @@ def test_nested_on_new_span_on_close(
173171 if span_streaming :
174172 items = capture_items ("event" , "transaction" , "span" )
175173 with sentry_sdk .traces .start_span (name = "custom parent" ):
176- original_sentry_span = sentry_sdk .traces ._get_current_streamed_span ()
174+ original_sentry_span = sentry_sdk .traces .get_current_span ()
177175
178176 rust_tracing .new_span (RustTracingLevel .Info , 3 , index_arg = 10 )
179- sentry_first_rust_span = sentry_sdk .traces ._get_current_streamed_span ()
177+ sentry_first_rust_span = sentry_sdk .traces .get_current_span ()
180178 rust_first_rust_span = rust_tracing .spans [3 ]
181179
182180 # Use a different `index_arg` value for the inner span to help
183181 # distinguish the two at the end of the test
184182 rust_tracing .new_span (RustTracingLevel .Info , 5 , index_arg = 9 )
185- sentry_second_rust_span = sentry_sdk .traces ._get_current_streamed_span ()
183+ sentry_second_rust_span = sentry_sdk .traces .get_current_span ()
186184 rust_second_rust_span = rust_tracing .spans [5 ]
187185
188186 assert rust_second_rust_span == sentry_second_rust_span
189187
190188 rust_tracing .close_span (5 )
191189
192190 # Ensure the current sentry span was moved back to the parent
193- sentry_span_after_close = sentry_sdk .traces ._get_current_streamed_span ()
191+ sentry_span_after_close = sentry_sdk .traces .get_current_span ()
194192 assert sentry_span_after_close == sentry_first_rust_span
195193 assert sentry_span_after_close == rust_first_rust_span
196194
197195 rust_tracing .close_span (3 )
198196
199- assert (
200- sentry_sdk .traces ._get_current_streamed_span () == original_sentry_span
201- )
197+ assert sentry_sdk .traces .get_current_span () == original_sentry_span
202198
203199 sentry_sdk .flush ()
204200 spans = [item .payload for item in items if item .type == "span" ]
@@ -312,10 +308,10 @@ def test_on_new_span_without_transaction(sentry_init, span_streaming):
312308 )
313309
314310 if span_streaming :
315- assert sentry_sdk .traces ._get_current_streamed_span () is None
311+ assert sentry_sdk .traces .get_current_span () is None
316312
317313 rust_tracing .new_span (RustTracingLevel .Info , 3 )
318- current_span = sentry_sdk .traces ._get_current_streamed_span ()
314+ current_span = sentry_sdk .traces .get_current_span ()
319315 assert current_span is not None
320316 assert current_span ._segment is current_span
321317 else :
@@ -584,24 +580,22 @@ def span_filter(metadata: Dict[str, object]) -> bool:
584580 if span_streaming :
585581 items = capture_items ("event" , "transaction" , "span" )
586582 with sentry_sdk .traces .start_span (name = "custom parent" ):
587- original_sentry_span = sentry_sdk .traces ._get_current_streamed_span ()
583+ original_sentry_span = sentry_sdk .traces .get_current_span ()
588584
589585 # Span is not ignored
590586 rust_tracing .new_span (RustTracingLevel .Info , 3 , index_arg = 10 )
591- info_span = sentry_sdk .traces ._get_current_streamed_span ()
587+ info_span = sentry_sdk .traces .get_current_span ()
592588
593589 # Span is ignored, current span should remain the same
594590 rust_tracing .new_span (RustTracingLevel .Trace , 5 , index_arg = 9 )
595- assert sentry_sdk .traces ._get_current_streamed_span () == info_span
591+ assert sentry_sdk .traces .get_current_span () == info_span
596592
597593 # Closing the filtered span should leave the current span alone
598594 rust_tracing .close_span (5 )
599- assert sentry_sdk .traces ._get_current_streamed_span () == info_span
595+ assert sentry_sdk .traces .get_current_span () == info_span
600596
601597 rust_tracing .close_span (3 )
602- assert (
603- sentry_sdk .traces ._get_current_streamed_span () == original_sentry_span
604- )
598+ assert sentry_sdk .traces .get_current_span () == original_sentry_span
605599
606600 sentry_sdk .flush ()
607601 spans = [item .payload for item in items if item .type == "span" ]
@@ -652,16 +646,12 @@ def test_record(sentry_init, span_streaming):
652646 with sentry_sdk .traces .start_span (name = "custom parent" ):
653647 rust_tracing .new_span (RustTracingLevel .Info , 3 )
654648
655- span_before_record = (
656- sentry_sdk .traces ._get_current_streamed_span ()._to_json ()
657- )
649+ span_before_record = sentry_sdk .traces .get_current_span ()._to_json ()
658650 assert span_before_record ["attributes" ]["version" ] == "None"
659651
660652 rust_tracing .record (3 )
661653
662- span_after_record = (
663- sentry_sdk .traces ._get_current_streamed_span ()._to_json ()
664- )
654+ span_after_record = sentry_sdk .traces .get_current_span ()._to_json ()
665655 assert span_after_record ["attributes" ]["version" ] == "memoized"
666656 else :
667657 with start_transaction ():
@@ -699,18 +689,14 @@ def span_filter(metadata: Dict[str, object]) -> bool:
699689 with sentry_sdk .traces .start_span (name = "custom parent" ):
700690 rust_tracing .new_span (RustTracingLevel .Info , 3 )
701691
702- span_before_record = (
703- sentry_sdk .traces ._get_current_streamed_span ()._to_json ()
704- )
692+ span_before_record = sentry_sdk .traces .get_current_span ()._to_json ()
705693 assert span_before_record ["attributes" ]["version" ] == "None"
706694
707695 rust_tracing .new_span (RustTracingLevel .Trace , 5 )
708696 rust_tracing .record (5 )
709697
710698 # `on_record()` should not do anything to the current Sentry span if the associated Rust span was ignored
711- span_after_record = (
712- sentry_sdk .traces ._get_current_streamed_span ()._to_json ()
713- )
699+ span_after_record = sentry_sdk .traces .get_current_span ()._to_json ()
714700 assert span_after_record ["attributes" ]["version" ] == "None"
715701 else :
716702 with start_transaction ():
@@ -764,19 +750,15 @@ def test_include_tracing_fields(
764750 with sentry_sdk .traces .start_span (name = "custom parent" ):
765751 rust_tracing .new_span (RustTracingLevel .Info , 3 )
766752
767- span_before_record = (
768- sentry_sdk .traces ._get_current_streamed_span ()._to_json ()
769- )
753+ span_before_record = sentry_sdk .traces .get_current_span ()._to_json ()
770754 if tracing_fields_expected :
771755 assert span_before_record ["attributes" ]["version" ] == "None"
772756 else :
773757 assert span_before_record ["attributes" ]["version" ] == "[Filtered]"
774758
775759 rust_tracing .record (3 )
776760
777- span_after_record = (
778- sentry_sdk .traces ._get_current_streamed_span ()._to_json ()
779- )
761+ span_after_record = sentry_sdk .traces .get_current_span ()._to_json ()
780762
781763 if tracing_fields_expected :
782764 assert span_after_record ["attributes" ] == {
0 commit comments