|
30 | 30 | from typing import Tuple |
31 | 31 | from typing import Union |
32 | 32 | from typing import TypeVar |
33 | | - from typing import Sequence |
| 33 | + from typing import Set |
34 | 34 |
|
35 | 35 | from typing_extensions import TypedDict, Unpack |
36 | 36 |
|
@@ -971,29 +971,6 @@ def _get_scope_from_finish_args( |
971 | 971 |
|
972 | 972 | return scope_or_hub |
973 | 973 |
|
974 | | - def _in_http_status_code_range(self, code, code_ranges): |
975 | | - # type: (int, Sequence[Union[int, Tuple[int, int]]]) -> bool |
976 | | - for target in code_ranges: |
977 | | - if isinstance(target, int): |
978 | | - if code == target: |
979 | | - return True |
980 | | - continue |
981 | | - |
982 | | - wrong_type_message = "trace_ignore_status_codes must be a list of integers or pairs of integers." |
983 | | - try: |
984 | | - low, high = target |
985 | | - if not isinstance(low, int) or not isinstance(high, int): |
986 | | - logger.warning(wrong_type_message) |
987 | | - continue |
988 | | - |
989 | | - if low <= code <= high: |
990 | | - return True |
991 | | - |
992 | | - except Exception: |
993 | | - logger.warning(wrong_type_message) |
994 | | - |
995 | | - return False |
996 | | - |
997 | 974 | def _get_log_representation(self): |
998 | 975 | # type: () -> str |
999 | 976 | return "{op}transaction <{name}>".format( |
@@ -1074,9 +1051,9 @@ def finish( |
1074 | 1051 | logger.warning( |
1075 | 1052 | f"Invalid type for http.response.status_code; is {status_code!r} of type {type(status_code)}, expected an int." |
1076 | 1053 | ) |
1077 | | - elif status_code is not None and self._in_http_status_code_range( |
1078 | | - status_code, |
1079 | | - client.options["trace_ignore_status_codes"], |
| 1054 | + elif ( |
| 1055 | + status_code is not None |
| 1056 | + and status_code in client.options["trace_ignore_status_codes"] |
1080 | 1057 | ): |
1081 | 1058 | logger.debug( |
1082 | 1059 | "[Tracing] Discarding {transaction_description} because the HTTP status code {status_code} is matched by trace_ignore_status_codes: {trace_ignore_status_codes}".format( |
|
0 commit comments