@@ -165,8 +165,8 @@ class Scope(object):
165
165
"_level" ,
166
166
"_name" ,
167
167
"_fingerprint" ,
168
- "_segment_span_name " ,
169
- "_segment_span_info " ,
168
+ "_root_span_name " ,
169
+ "_root_span_info " ,
170
170
"_user" ,
171
171
"_tags" ,
172
172
"_contexts" ,
@@ -218,8 +218,8 @@ def __copy__(self):
218
218
rv ._level = self ._level
219
219
rv ._name = self ._name
220
220
rv ._fingerprint = self ._fingerprint
221
- rv ._segment_span_name = self ._segment_span_name
222
- rv ._segment_span_info = dict (self ._segment_span_info )
221
+ rv ._root_span_name = self ._root_span_name
222
+ rv ._root_span_info = dict (self ._root_span_info )
223
223
rv ._user = self ._user
224
224
225
225
rv ._tags = dict (self ._tags )
@@ -669,8 +669,8 @@ def clear(self):
669
669
"""Clears the entire scope."""
670
670
self ._level = None # type: Optional[LogLevelStr]
671
671
self ._fingerprint = None # type: Optional[List[str]]
672
- self ._segment_span_name = None # type: Optional[str]
673
- self ._segment_span_info = {} # type: MutableMapping[str, str]
672
+ self ._root_span_name = None # type: Optional[str]
673
+ self ._root_span_info = {} # type: MutableMapping[str, str]
674
674
self ._user = None # type: Optional[Dict[str, Any]]
675
675
676
676
self ._tags = {} # type: Dict[str, Any]
@@ -715,49 +715,49 @@ def transaction(self):
715
715
Return the transaction in the scope, if any.
716
716
717
717
.. deprecated:: 3.0.0
718
- This function is deprecated and will be removed in a future release. Use Scope.segment_span instead.
718
+ This function is deprecated and will be removed in a future release. Use Scope.root_span instead.
719
719
"""
720
720
721
721
logger .warning (
722
- "Deprecated: use Scope.segment_span instead. This will be removed in the future."
722
+ "Deprecated: use Scope.root_span instead. This will be removed in the future."
723
723
)
724
724
725
- return self .segment_span
725
+ return self .root_span
726
726
727
727
@property
728
- def segment_span (self ):
728
+ def root_span (self ):
729
729
"""Return the root span in the scope, if any."""
730
730
# there is no span/transaction on the scope
731
731
if self ._span is None :
732
732
return None
733
733
734
734
# there is an orphan span on the scope
735
- if self ._span .segment_span is None :
735
+ if self ._span .root_span is None :
736
736
return None
737
737
738
738
# there is either a root span (which is its own containing
739
739
# root span) or a non-orphan span on the scope
740
- return self ._span .segment_span
740
+ return self ._span .root_span
741
741
742
742
def set_transaction_name (self , name , source = None ):
743
743
# type: (str, Optional[str]) -> None
744
744
"""
745
745
Set the transaction name and optionally the transaction source.
746
746
747
747
.. deprecated:: 3.0.0
748
- This function is deprecated and will be removed in a future release. Use Scope.set_segment_span_name instead.
748
+ This function is deprecated and will be removed in a future release. Use Scope.set_root_span_name instead.
749
749
"""
750
- self .set_segment_span_name (name , source )
750
+ self .set_root_span_name (name , source )
751
751
752
- def set_segment_span_name (self , name , source = None ):
752
+ def set_root_span_name (self , name , source = None ):
753
753
"""Set the root span name and optionally the source."""
754
- self ._segment_span_name = name
755
- if self ._span and self ._span .segment_span :
756
- self ._span .segment_span .name = name
754
+ self ._root_span_name = name
755
+ if self ._span and self ._span .root_span :
756
+ self ._span .root_span .name = name
757
757
if source :
758
- self ._span .segment_span .source = source
758
+ self ._span .root_span .source = source
759
759
if source :
760
- self ._segment_span_info ["source" ] = source
760
+ self ._root_span_info ["source" ] = source
761
761
762
762
@_attr_setter
763
763
def user (self , value ):
@@ -789,9 +789,9 @@ def span(self, span):
789
789
return
790
790
if span .is_segment :
791
791
if span .name :
792
- self ._segment_span_name = span .name
792
+ self ._root_span_name = span .name
793
793
if span .source :
794
- self ._segment_span_info ["source" ] = span .source
794
+ self ._root_span_info ["source" ] = span .source
795
795
796
796
@property
797
797
def profile (self ):
@@ -1016,7 +1016,7 @@ def start_transaction(
1016
1016
1017
1017
return span
1018
1018
1019
- def start_span (self , segment_span = None , custom_sampling_context = None , ** kwargs ):
1019
+ def start_span (self , root_span = None , custom_sampling_context = None , ** kwargs ):
1020
1020
# type: (Optional[Span], Optional[SamplingContext], Any) -> Span
1021
1021
"""
1022
1022
Start a span whose parent is the currently active span or transaction, if any.
@@ -1028,8 +1028,8 @@ def start_span(self, segment_span=None, custom_sampling_context=None, **kwargs):
1028
1028
For supported `**kwargs` see :py:class:`sentry_sdk.tracing.Span`.
1029
1029
"""
1030
1030
kwargs .setdefault ("scope" , self )
1031
- if segment_span :
1032
- return segment_span
1031
+ if root_span :
1032
+ return root_span
1033
1033
1034
1034
span = self .span or self .get_isolation_scope ().span
1035
1035
@@ -1073,15 +1073,15 @@ def continue_trace(
1073
1073
"""
1074
1074
self .generate_propagation_context (environ_or_headers )
1075
1075
1076
- segment_span = Span .continue_from_headers (
1076
+ root_span = Span .continue_from_headers (
1077
1077
normalize_incoming_data (environ_or_headers ),
1078
1078
op = op ,
1079
1079
origin = origin ,
1080
1080
name = name ,
1081
1081
source = source ,
1082
1082
)
1083
1083
1084
- return segment_span
1084
+ return root_span
1085
1085
1086
1086
def capture_event (self , event , hint = None , scope = None , ** scope_kwargs ):
1087
1087
# type: (Event, Optional[Hint], Optional[Scope], Any) -> Optional[str]
@@ -1276,18 +1276,18 @@ def _apply_user_to_event(self, event, hint, options):
1276
1276
if event .get ("user" ) is None and self ._user is not None :
1277
1277
event ["user" ] = self ._user
1278
1278
1279
- def _apply_segment_span_name_to_event (self , event , hint , options ):
1279
+ def _apply_root_span_name_to_event (self , event , hint , options ):
1280
1280
# type: (Event, Hint, Optional[Dict[str, Any]]) -> None
1281
- if event .get ("transaction" ) is None and self ._segment_span_name is not None :
1282
- event ["transaction" ] = self ._segment_span_name
1281
+ if event .get ("transaction" ) is None and self ._root_span_name is not None :
1282
+ event ["transaction" ] = self ._root_span_name
1283
1283
1284
- def _apply_segment_span_info_to_event (self , event , hint , options ):
1284
+ def _apply_root_span_info_to_event (self , event , hint , options ):
1285
1285
# type: (Event, Hint, Optional[Dict[str, Any]]) -> None
1286
1286
if (
1287
1287
event .get ("transaction_info" ) is None
1288
- and self ._segment_span_info is not None
1288
+ and self ._root_span_info is not None
1289
1289
):
1290
- event ["transaction_info" ] = self ._segment_span_info
1290
+ event ["transaction_info" ] = self ._root_span_info
1291
1291
1292
1292
def _apply_fingerprint_to_event (self , event , hint , options ):
1293
1293
# type: (Event, Hint, Optional[Dict[str, Any]]) -> None
@@ -1409,8 +1409,8 @@ def apply_to_event(
1409
1409
self ._apply_level_to_event (event , hint , options )
1410
1410
self ._apply_fingerprint_to_event (event , hint , options )
1411
1411
self ._apply_user_to_event (event , hint , options )
1412
- self ._apply_segment_span_name_to_event (event , hint , options )
1413
- self ._apply_segment_span_info_to_event (event , hint , options )
1412
+ self ._apply_root_span_name_to_event (event , hint , options )
1413
+ self ._apply_root_span_info_to_event (event , hint , options )
1414
1414
self ._apply_tags_to_event (event , hint , options )
1415
1415
self ._apply_extra_to_event (event , hint , options )
1416
1416
@@ -1434,10 +1434,10 @@ def update_from_scope(self, scope):
1434
1434
self ._level = scope ._level
1435
1435
if scope ._fingerprint is not None :
1436
1436
self ._fingerprint = scope ._fingerprint
1437
- if scope ._segment_span_name is not None :
1438
- self ._segment_span_name = scope ._segment_span_name
1439
- if scope ._segment_span_info is not None :
1440
- self ._segment_span_info .update (scope ._segment_span_info )
1437
+ if scope ._root_span_name is not None :
1438
+ self ._root_span_name = scope ._root_span_name
1439
+ if scope ._root_span_info is not None :
1440
+ self ._root_span_info .update (scope ._root_span_info )
1441
1441
if scope ._user is not None :
1442
1442
self ._user = scope ._user
1443
1443
if scope ._tags :
0 commit comments