File tree Expand file tree Collapse file tree 1 file changed +2
-23
lines changed
opentelemetry-instrumentation/src/opentelemetry/instrumentation Expand file tree Collapse file tree 1 file changed +2
-23
lines changed Original file line number Diff line number Diff line change @@ -40,34 +40,13 @@ def http_status_to_status_code(
40
40
Args:
41
41
status (int): HTTP status code
42
42
"""
43
- # pylint:disable=too-many-branches,too-many-return-statements
44
43
# See: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/http.md#status
45
44
if status < 100 :
46
45
return StatusCode .ERROR
47
46
if status <= 299 :
48
47
return StatusCode .UNSET
49
- if status <= 399 :
50
- if allow_redirect :
51
- return StatusCode .UNSET
52
- return StatusCode .ERROR
53
- if status <= 499 :
54
- if status == 401 : # HTTPStatus.UNAUTHORIZED:
55
- return StatusCode .ERROR
56
- if status == 403 : # HTTPStatus.FORBIDDEN:
57
- return StatusCode .ERROR
58
- if status == 404 : # HTTPStatus.NOT_FOUND:
59
- return StatusCode .ERROR
60
- if status == 429 : # HTTPStatus.TOO_MANY_REQUESTS:
61
- return StatusCode .ERROR
62
- return StatusCode .ERROR
63
- if status <= 599 :
64
- if status == 501 : # HTTPStatus.NOT_IMPLEMENTED:
65
- return StatusCode .ERROR
66
- if status == 503 : # HTTPStatus.SERVICE_UNAVAILABLE:
67
- return StatusCode .ERROR
68
- if status == 504 : # HTTPStatus.GATEWAY_TIMEOUT:
69
- return StatusCode .ERROR
70
- return StatusCode .ERROR
48
+ if status <= 399 and allow_redirect :
49
+ return StatusCode .UNSET
71
50
return StatusCode .ERROR
72
51
73
52
You can’t perform that action at this time.
0 commit comments