File tree 2 files changed +10
-0
lines changed
opentelemetry-instrumentation
src/opentelemetry/instrumentation
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ def http_status_to_status_code(
46
46
status (int): HTTP status code
47
47
"""
48
48
# See: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#status
49
+ if status is None :
50
+ return StatusCode .UNSET
49
51
if status < 100 :
50
52
return StatusCode .ERROR
51
53
if status <= 299 :
Original file line number Diff line number Diff line change @@ -56,6 +56,14 @@ def test_http_status_to_status_code(self):
56
56
actual = http_status_to_status_code (int (status_code ))
57
57
self .assertEqual (actual , expected , status_code )
58
58
59
+ def test_http_status_to_status_code_none (self ):
60
+ for status_code , expected in (
61
+ (None , StatusCode .UNSET ),
62
+ ):
63
+ with self .subTest (status_code = status_code ):
64
+ actual = http_status_to_status_code (status_code )
65
+ self .assertEqual (actual , expected , status_code )
66
+
59
67
def test_http_status_to_status_code_redirect (self ):
60
68
for status_code , expected in (
61
69
(HTTPStatus .MULTIPLE_CHOICES , StatusCode .ERROR ),
You can’t perform that action at this time.
0 commit comments