Skip to content

Commit 74cde81

Browse files
.
1 parent 5374552 commit 74cde81

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

sentry_sdk/tracing.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -986,12 +986,6 @@ def _in_http_status_code_range(self, code, code_ranges):
986986
logger.warning(wrong_type_message)
987987
continue
988988

989-
if not isinstance(code, int):
990-
logger.warning(
991-
f"Invalid type for http.response.status_code; is {code!r} of type {type(code)}, expected an int."
992-
)
993-
continue
994-
995989
if low <= code <= high:
996990
return True
997991

@@ -1075,8 +1069,13 @@ def finish(
10751069

10761070
super().finish(scope, end_timestamp)
10771071

1078-
if SPANDATA.HTTP_STATUS_CODE in self._data and self._in_http_status_code_range(
1079-
self._data[SPANDATA.HTTP_STATUS_CODE],
1072+
status_code = self._data.get(SPANDATA.HTTP_STATUS_CODE)
1073+
if status_code and not isinstance(status_code, int):
1074+
logger.warning(
1075+
f"Invalid type for http.response.status_code; is {status_code!r} of type {type(status_code)}, expected an int."
1076+
)
1077+
elif status_code and self._in_http_status_code_range(
1078+
status_code,
10801079
client.options["trace_ignore_status_codes"],
10811080
):
10821081
logger.debug(

0 commit comments

Comments
 (0)