Description
How do you use Sentry?
Sentry Saas (sentry.io)
Version
1.31.0
Steps to Reproduce
Use the python sentry sdk in conjunction with FastAPI and the NewRelic python agent.
View transactions in the NewRelic UI.
Expected Result
The NewRelic transaction name should show the function name handling the FastAPI route.
Actual Result
New Relic services representing our new fastapi services are seeing significant time spent in a transaction named sentry_sdk.integrations.fastapi:patch_get_request_handler.<locals>._sentry_get_request_handler.<locals>._sentry_call
.
The source code for fastspi:patch_get_request_handler
wraps non-async request handlers in a local function called _sentry_call
. This local function shares the same __qualname__
responsible for the significant transaction time. The result is every route handler has the same name and it appears in New Relic that the service has one transaction type.
Sentry sdk integrations wrap functions all the time to create sentry scope and yet we never have this problem. It appears the issue comes from a simple oversight when writing the fastapi integration. Other integrations use sentry_sdk._functools:wraps
to wrap a function with sentry specific behavior, yet ensure the name, qualname, etc. are retrained from the wrapped function.
Metadata
Metadata
Assignees
Type
Projects
Status