2525from sentry_sdk .sessions import track_session
2626from sentry_sdk .tracing import (
2727 SOURCE_FOR_STYLE ,
28- TRANSACTION_SOURCE_ROUTE ,
29- TRANSACTION_SOURCE_URL ,
30- TRANSACTION_SOURCE_COMPONENT ,
31- TRANSACTION_SOURCE_CUSTOM ,
28+ TransactionSource ,
3229)
3330from sentry_sdk .utils import (
3431 ContextVar ,
@@ -265,9 +262,9 @@ def event_processor(self, event, hint, asgi_scope):
265262 and "source" in event ["transaction_info" ]
266263 and event ["transaction_info" ]["source" ]
267264 in [
268- TRANSACTION_SOURCE_COMPONENT ,
269- TRANSACTION_SOURCE_ROUTE ,
270- TRANSACTION_SOURCE_CUSTOM ,
265+ TransactionSource . COMPONENT ,
266+ TransactionSource . ROUTE ,
267+ TransactionSource . CUSTOM ,
271268 ]
272269 )
273270 if not already_set :
@@ -306,7 +303,7 @@ def _get_transaction_name_and_source(self, transaction_style, asgi_scope):
306303 name = transaction_from_function (endpoint ) or ""
307304 else :
308305 name = _get_url (asgi_scope , "http" if ty == "http" else "ws" , host = None )
309- source = TRANSACTION_SOURCE_URL
306+ source = TransactionSource . URL
310307
311308 elif transaction_style == "url" :
312309 # FastAPI includes the route object in the scope to let Sentry extract the
@@ -318,11 +315,11 @@ def _get_transaction_name_and_source(self, transaction_style, asgi_scope):
318315 name = path
319316 else :
320317 name = _get_url (asgi_scope , "http" if ty == "http" else "ws" , host = None )
321- source = TRANSACTION_SOURCE_URL
318+ source = TransactionSource . URL
322319
323320 if name is None :
324321 name = _DEFAULT_TRANSACTION_NAME
325- source = TRANSACTION_SOURCE_ROUTE
322+ source = TransactionSource . ROUTE
326323 return name , source
327324
328325 return name , source
0 commit comments