55from importlib import import_module
66
77import sentry_sdk
8- from sentry_sdk .consts import OP , SPANDATA , DBOPERATION
8+ from sentry_sdk .consts import OP , SPANDATA , SPANNAME
99from sentry_sdk .scope import add_global_event_processor , should_send_default_pii
1010from sentry_sdk .serializer import add_global_repr_processor , add_repr_sequence_type
1111from sentry_sdk .tracing import SOURCE_FOR_STYLE , TransactionSource
@@ -132,7 +132,7 @@ def __init__(
132132 middleware_spans = True , # type: bool
133133 signals_spans = True , # type: bool
134134 cache_spans = False , # type: bool
135- database_transaction_spans = False , # type: bool
135+ db_transaction_spans = False , # type: bool
136136 signals_denylist = None , # type: Optional[list[signals.Signal]]
137137 http_methods_to_capture = DEFAULT_HTTP_METHODS_TO_CAPTURE , # type: tuple[str, ...]
138138 ):
@@ -149,7 +149,7 @@ def __init__(
149149 self .signals_denylist = signals_denylist or []
150150
151151 self .cache_spans = cache_spans
152- self .database_transaction_spans = database_transaction_spans
152+ self .db_transaction_spans = db_transaction_spans
153153
154154 self .http_methods_to_capture = tuple (map (str .upper , http_methods_to_capture ))
155155
@@ -694,20 +694,19 @@ def connect(self):
694694 _set_db_data (span , self )
695695 return real_connect (self )
696696
697- @ensure_integration_enabled (DjangoIntegration , real_commit )
698697 def _commit (self ):
699698 # type: (BaseDatabaseWrapper) -> None
700699 integration = sentry_sdk .get_client ().get_integration (DjangoIntegration )
701700
702- if integration is None or not integration .database_transaction_spans :
701+ if integration is None or not integration .db_transaction_spans :
703702 return real_commit (self )
704703
705704 with sentry_sdk .start_span (
706705 op = OP .DB ,
707- name = DBOPERATION .COMMIT ,
706+ name = SPANNAME .COMMIT ,
708707 origin = DjangoIntegration .origin_db ,
709708 ) as span :
710- _set_db_data (span , self , DBOPERATION .COMMIT )
709+ _set_db_data (span , self , SPANNAME .COMMIT )
711710 return real_commit (self )
712711
713712 @ensure_integration_enabled (DjangoIntegration , real_rollback )
@@ -720,10 +719,10 @@ def _rollback(self):
720719
721720 with sentry_sdk .start_span (
722721 op = OP .DB ,
723- name = DBOPERATION .ROLLBACK ,
722+ name = SPANNAME .ROLLBACK ,
724723 origin = DjangoIntegration .origin_db ,
725724 ) as span :
726- _set_db_data (span , self , DBOPERATION .ROLLBACK )
725+ _set_db_data (span , self , SPANNAME .ROLLBACK )
727726 return real_rollback (self )
728727
729728 CursorWrapper .execute = execute
0 commit comments