-
Notifications
You must be signed in to change notification settings - Fork 505
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
feat(profiling): Enable profiling for ASGI frameworks #1824
feat(profiling): Enable profiling for ASGI frameworks #1824
Conversation
This enables profiling for ASGI frameworks. When running in ASGI sync views, the transaction gets started in the main thread then the request is dispatched to a handler thread. We want to set the handler thread as the active thread id to ensure that profiles will show it on first render.
4411f92
to
2c9d119
Compare
Following up to #1824 to set the active thread id for quart.
with hub.configure_scope() as sentry_scope: | ||
if sentry_scope.profile is not None: | ||
sentry_scope.profile.active_thread_id = ( | ||
threading.current_thread().ident |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because current_thread()
can be a dummy object (see https://docs.python.org/3/library/threading.html#threading.current_thread) maybe it is saver to use threading.get_ident()
?
(But if the dummy object also has a .ident
my comment can be ignored)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up to #1824 to set the active thread id for quart.
Following up to #1824 to set the active thread id for quart.
Following up to #1824 to set the active thread id for quart.
This enables profiling for ASGI frameworks. When running in ASGI sync views, the
transaction gets started in the main thread then the request is dispatched to a
handler thread. We want to set the handler thread as the active thread id to
ensure that profiles will show it on first render.