Closed
Description
- Package Name: azure-monitor-opentelemetry
- Package Version: 1.6.5
- Operating System: Windows (WSL2)
- Python Version: 3.12.9
Describe the bug
I noticed that the FastAPI instrumentation reports the response status code as 0 when an exception is thrown.
To Reproduce
Steps to reproduce the behavior:
- Run https://github.com/Azure/azure-sdk-for-python/blob/23163bcb045d3564f8419fdf99eaef99e0642e5b/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/http_fastapi.py
- Send request to
http://127.0.0.1:8008/exception
Expected behavior
Request with Response Code 500
is logged in Application Insights
Actual behavior
Response code is 0