26
26
SENTRY_TRACE_HEADER_NAME ,
27
27
NoOpSpan ,
28
28
Span ,
29
- POTelSpan ,
30
- Transaction ,
31
29
)
32
30
from sentry_sdk .utils import (
33
31
capture_internal_exception ,
@@ -677,7 +675,7 @@ def clear(self):
677
675
self .clear_breadcrumbs ()
678
676
self ._should_capture = True # type: bool
679
677
680
- self ._span = None # type: Optional[POTelSpan ]
678
+ self ._span = None # type: Optional[Span ]
681
679
self ._session = None # type: Optional[Session]
682
680
self ._force_auto_session_tracking = None # type: Optional[bool]
683
681
@@ -707,7 +705,7 @@ def fingerprint(self, value):
707
705
@property
708
706
def transaction (self ):
709
707
# type: () -> Any
710
- # would be type: () -> Optional[Transaction ], see https://github.com/python/mypy/issues/3004
708
+ # would be type: () -> Optional[Span ], see https://github.com/python/mypy/issues/3004
711
709
"""Return the transaction (root span) in the scope, if any."""
712
710
713
711
# there is no span/transaction on the scope
@@ -734,7 +732,7 @@ def transaction(self, value):
734
732
# anything set in the scope.
735
733
# XXX: note that with the introduction of the Scope.transaction getter,
736
734
# there is a semantic and type mismatch between getter and setter. The
737
- # getter returns a Transaction , the setter sets a transaction name.
735
+ # getter returns a Span , the setter sets a transaction name.
738
736
# Without breaking version compatibility, we could make the setter set a
739
737
# transaction name or transaction (self._span) depending on the type of
740
738
# the value argument.
@@ -785,13 +783,13 @@ def set_user(self, value):
785
783
786
784
@property
787
785
def span (self ):
788
- # type: () -> Optional[POTelSpan ]
786
+ # type: () -> Optional[Span ]
789
787
"""Get current tracing span."""
790
788
return self ._span
791
789
792
790
@span .setter
793
791
def span (self , span ):
794
- # type: (Optional[POTelSpan ]) -> None
792
+ # type: (Optional[Span ]) -> None
795
793
"""Set current tracing span."""
796
794
self ._span = span
797
795
@@ -952,7 +950,7 @@ def add_breadcrumb(self, crumb=None, hint=None, **kwargs):
952
950
self ._breadcrumbs .popleft ()
953
951
954
952
def start_transaction (self , transaction = None , ** kwargs ):
955
- # type: (Optional[Transaction ], Optional[SamplingContext], Unpack[TransactionKwargs]) -> Union[Transaction , NoOpSpan]
953
+ # type: (Optional[Span ], Optional[SamplingContext], Unpack[TransactionKwargs]) -> Union[Span , NoOpSpan]
956
954
"""
957
955
Start and return a transaction.
958
956
@@ -981,14 +979,15 @@ def start_transaction(self, transaction=None, **kwargs):
981
979
constructor. See :py:class:`sentry_sdk.tracing.Transaction` for
982
980
available arguments.
983
981
"""
982
+ # TODO-neel-potel fix signature and no op
984
983
kwargs .setdefault ("scope" , self )
985
984
986
985
client = self .get_client ()
987
986
988
987
try_autostart_continuous_profiler ()
989
988
990
989
# if we haven't been given a transaction, make one
991
- transaction = Transaction (** kwargs )
990
+ transaction = Span (** kwargs )
992
991
993
992
# use traces_sample_rate, traces_sampler, and/or inheritance to make a
994
993
# sampling decision
@@ -1024,6 +1023,7 @@ def start_span(self, **kwargs):
1024
1023
1025
1024
For supported `**kwargs` see :py:class:`sentry_sdk.tracing.Span`.
1026
1025
"""
1026
+ # TODO-neel-potel fix signature and no op
1027
1027
if kwargs .get ("description" ) is not None :
1028
1028
warnings .warn (
1029
1029
"The `description` parameter is deprecated. Please use `name` instead." ,
@@ -1054,13 +1054,14 @@ def start_span(self, **kwargs):
1054
1054
def continue_trace (
1055
1055
self , environ_or_headers , op = None , name = None , source = None , origin = None
1056
1056
):
1057
- # type: (Dict[str, Any], Optional[str], Optional[str], Optional[str], Optional[str]) -> Transaction
1057
+ # TODO-neel-potel fix signature and no op
1058
+ # type: (Dict[str, Any], Optional[str], Optional[str], Optional[str], Optional[str]) -> Span
1058
1059
"""
1059
1060
Sets the propagation context from environment or headers and returns a transaction.
1060
1061
"""
1061
1062
self .generate_propagation_context (environ_or_headers )
1062
1063
1063
- transaction = Transaction .continue_from_headers (
1064
+ transaction = Span .continue_from_headers (
1064
1065
normalize_incoming_data (environ_or_headers ),
1065
1066
op = op ,
1066
1067
origin = origin ,
0 commit comments