File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
instrumentation/opentelemetry-instrumentation-fastapi/tests Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1904,12 +1904,14 @@ def tearDown(self) -> None:
19041904 def test_error_handler_context (self ):
19051905 """OTEL tracing contexts must be available during error handler execution"""
19061906
1907+ status_code = 501
1908+
19071909 @self .app .exception_handler (Exception )
19081910 async def _ (* _ ):
19091911 self .error_trace_id = (
19101912 trace .get_current_span ().get_span_context ().trace_id
19111913 )
1912- return PlainTextResponse ("" , status_code = 500 )
1914+ return PlainTextResponse ("" , status_code )
19131915
19141916 @self .app .get ("/foobar" )
19151917 async def _ ():
@@ -1933,7 +1935,7 @@ async def _():
19331935 self .assertEqual (len (spans ), 3 )
19341936 span = spans [2 ]
19351937 self .assertEqual (span .name , "GET /foobar" )
1936- self .assertEqual (span .attributes .get (HTTP_STATUS_CODE ), 500 )
1938+ self .assertEqual (span .attributes .get (HTTP_STATUS_CODE ), status_code )
19371939 self .assertEqual (span .status .status_code , StatusCode .ERROR )
19381940 self .assertEqual (len (span .events ), 1 )
19391941 event = span .events [0 ]
You can’t perform that action at this time.
0 commit comments