Repository navigation
refactor(fastapi): use a global dependency for active thread tracking - #7826
faizansaiyed123 wants to merge 35 commits into
Conversation
ffa6378 to
c428c6e
Compare
|
cursor review |
|
bugbot run verbose=true |
|
Bugbot request id: 8939ba6b-1511-41cb-8bd6-5514646cb90c |
Bugbot rules debugNo rules were used for this review. https://cursor.com/docs/bugbot#team-rules Bugbot request id: 8939ba6b-1511-41cb-8bd6-5514646cb90c |
|
Hey @faizansaiyed123, can you please update your PR now with the current master now that we've merged the thread change? |
1e3d9c2 to
3c15006
Compare
|
@sentrivana Updated the PR with the current master after #7825 was merged. I also addressed the duplicate Starlette patching issue found by Bugbot. Thanks for the guidance! |
|
@getsentry/owners-python-sdk @sentrivana Cursor Bugbot has completed successfully with no new issues found. Could someone with maintainer access please approve the pending CI and Test workflows so they can run on the latest commit? The previous Test run failed in the Mistral step with HTTP 401 ( Thanks! |
sentrivana
left a comment
There was a problem hiding this comment.
Hey @faizansaiyed123, I haven't done a full review of this yet, but there are two things I wanted to point out:
- The SDK now supports
data_collectionas a replacement forsend_default_pii. All code on master needs to support both. Ifdata_collectionis defined, it takes precedence oversend_default_pii. - Similarly, the SDK also supports span streaming with
trace_lifecycle="stream"and code on master needs to support both transaction-based tracing and span streaming.
I just glanced at the tests and it might be we're missing taking data_collection and trace_lifecycle="stream" into account there. Please also double check the non-test code if we need to add some if branches. You can have a look at how other similar integration and integration test suites do this.
LMK if you have any questions.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit efc5072. Configure here.

Ref #7753
Follow-up to #7825.
This PR replaces FastAPI's private
routing.get_request_handlermonkey patch with an application-level global dependency.Changes:
FastAPI.__init__to register a Sentry global dependency before user-supplied global dependencies.HTTPConnectioninjection so the dependency is safe for FastAPI versions where global dependencies also apply to WebSockets.http.routesetup into the dependency, using FastAPI's effective route context when available.Dependantso synchronous endpoints update thread metadata in their actual worker thread.get_request_handlerpatch.This branch includes #7825 so it can be reviewed end-to-end. Once #7825 is merged, this PR can be rebased/simplified to the dependency-only diff.