New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dd-trace auto-instrumentation not capturing error and stack trace details for HTTP Exception errors in FastAPI #9055
Comments
Thanks for the report @sats268842. We'll see if we can put together a demo app that reproduces this behavior. If you have one you can share, that would be helpful. |
@emmettbutler Additionally, I've discovered that if you install both the auto instrumentation library injection and the ddtrace Python package, the tracing and metrics won't work. Also I will look into demo app, if time permits. |
@emmettbutler Also got workaround for this issue using below code
|
@sats268842 Do you have any middleware installed that are catching exceptions and not re-raising them? I was running into the same issue, and it was due to this middleware: https://gist.github.com/nymous/f138c7f06062b7c43c060bf03759c29e, which does something like: response = Response(status_code=500)
try:
response = await call_next(request)
except Exception:
# do something
raise
finally:
# do something else
return response The problem was specifically with the I fixed it by moving the @app.exception_handler(Exception)
async def handle_exceptions(exc: Exception):
return Response(status_code=500) |
Summary of problem
When using dd-trace auto-instrumentation for a Python web application, 500 errors are not showing the full error message and stack trace in Datadog. Instead, the traces just show "Missing error message and stack trace".
Which version of dd-trace-py are you using?
latest
Which version of pip are you using?
24.0
Which libraries and their versions are you using?
fastapi = "^0.110.0"
How can we reproduce your problem?
Set up a Fastapi app with dd-trace auto-instrumentation enabled
Trigger a 500 error by causing an exception (e.g. divide by zero)
Check Datadog traces and you'll see 500 errors but no error details
What is the result that you get?
Traces for 500 errors show "Missing error message and stack trace"
What is the result that you expected?
The traces should show the full error message and stack trace for the exception that caused the 500 error.
The text was updated successfully, but these errors were encountered: