@@ -975,7 +975,6 @@ def _in_http_status_code_range(self, code, code_ranges):
975
975
# type: (int, Sequence[Union[int, Tuple[int, int]]]) -> bool
976
976
for target in code_ranges :
977
977
if isinstance (target , int ):
978
- print (code , target , code == target , type (code ), type (target ))
979
978
if code == target :
980
979
return True
981
980
continue
@@ -995,6 +994,11 @@ def _in_http_status_code_range(self, code, code_ranges):
995
994
996
995
return False
997
996
997
+ def _get_log_representation (self ):
998
+ return "{op}transaction <{name}>" .format (
999
+ op = ("<" + self .op + "> " if self .op else "" ), name = self .name
1000
+ )
1001
+
998
1002
def finish (
999
1003
self ,
1000
1004
scope = None , # type: Optional[sentry_sdk.Scope]
@@ -1068,6 +1072,15 @@ def finish(
1068
1072
self ._data [SPANDATA .HTTP_STATUS_CODE ],
1069
1073
client .options ["trace_ignore_status_codes" ],
1070
1074
):
1075
+ logger .debug (
1076
+ "[Tracing] Discarding {transaction_description} because the HTTP status code {status_code} is matched by trace_ignore_status_codes: {trace_ignore_status_codes}" .format (
1077
+ transaction_description = self ._get_log_reprensentation (),
1078
+ status_code = self ._data [SPANDATA .HTTP_STATUS_CODE ],
1079
+ trace_ignore_status_codes = client .options [
1080
+ "trace_ignore_status_codes"
1081
+ ],
1082
+ )
1083
+ )
1071
1084
self .sampled = False
1072
1085
1073
1086
if not self .sampled :
@@ -1217,9 +1230,7 @@ def _set_initial_sampling_decision(self, sampling_context):
1217
1230
"""
1218
1231
client = sentry_sdk .get_client ()
1219
1232
1220
- transaction_description = "{op}transaction <{name}>" .format (
1221
- op = ("<" + self .op + "> " if self .op else "" ), name = self .name
1222
- )
1233
+ transaction_description = self ._get_log_representation ()
1223
1234
1224
1235
# nothing to do if tracing is disabled
1225
1236
if not has_tracing_enabled (client .options ):
0 commit comments