@@ -975,7 +975,6 @@ def _in_http_status_code_range(self, code, code_ranges):
975975 # type: (int, Sequence[Union[int, Tuple[int, int]]]) -> bool
976976 for target in code_ranges :
977977 if isinstance (target , int ):
978- print (code , target , code == target , type (code ), type (target ))
979978 if code == target :
980979 return True
981980 continue
@@ -995,6 +994,11 @@ def _in_http_status_code_range(self, code, code_ranges):
995994
996995 return False
997996
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+
9981002 def finish (
9991003 self ,
10001004 scope = None , # type: Optional[sentry_sdk.Scope]
@@ -1068,6 +1072,15 @@ def finish(
10681072 self ._data [SPANDATA .HTTP_STATUS_CODE ],
10691073 client .options ["trace_ignore_status_codes" ],
10701074 ):
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+ )
10711084 self .sampled = False
10721085
10731086 if not self .sampled :
@@ -1217,9 +1230,7 @@ def _set_initial_sampling_decision(self, sampling_context):
12171230 """
12181231 client = sentry_sdk .get_client ()
12191232
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 ()
12231234
12241235 # nothing to do if tracing is disabled
12251236 if not has_tracing_enabled (client .options ):
0 commit comments