Skip to content

refactor: move FastAPI active thread tracking into Starlette - #7825

Open
faizansaiyed123 wants to merge 6 commits into
getsentry:masterfrom
faizansaiyed123:fix/7753-fastapi-thread-metadata
Open

faizansaiyed123 wants to merge 6 commits into
getsentry:masterfrom
faizansaiyed123:fix/7753-fastapi-thread-metadata

Conversation

@faizansaiyed123

@faizansaiyed123 faizansaiyed123 commented Oct 2, 2026 •

Copy link
Copy Markdown

Ref #7753

This separates the active-thread/profiler bookkeeping from the FastAPI-specific request handling.

Changes:

  • Centralize active-thread updates in the Starlette integration.
  • Provide a Starlette sync-handler wrapper so active-thread metadata is updated in the thread that actually executes a synchronous handler.
  • Reuse that wrapper from the FastAPI integration.
  • Preserve both static transaction and span-streaming behavior.

The follow-up FastAPI PR uses this Starlette helper while replacing the private FastAPI request-handler patch with a global dependency.

@faizansaiyed123
faizansaiyed123 requested a review from a team as a code owner October 2, 2026 03:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 87d3a13. Configure here.

Comment thread sentry_sdk/integrations/starlette.py

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant