-
Notifications
You must be signed in to change notification settings - Fork 227
Execution context - use thread locals if gevent/eventlet has monkey patched it #453
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
Conversation
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.
Great stuff! Would you mind adding a check for eventlet?
/edit: I pushed an import sort change to your branch, hope that's ok
return execution_context | ||
|
||
|
||
def threading_local_monkey_patched(): |
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.
While we're at it, it might make sense to do the same check for eventlet
http://eventlet.net/doc/patching.html#eventlet.patcher.is_monkey_patched
jenkins test this |
Oops, sorry for closing the PR, got ticket numbers mixed up in the commit message for 5337c43 🤦♂️ |
@ramshaw888 The build currently fails because of a linting issue. We use
I'll make sure to add these steps to our contributing guidelines. |
29bfaa4
to
6d9a7ff
Compare
d6c486d
to
2ebdf7c
Compare
…atched it elastic#453 * Extract out logic to decide which backing to use for execution_context into a function init_execution_context * Check if gevent or eventlet has monkey patched _threading.local, if it has then use elasticapm.context.threadlocal as the backing.
…atched it elastic#453 * Extract out logic to decide which backing to use for execution_context into a function init_execution_context * Check if gevent or eventlet has monkey patched _threading.local, if it has then use elasticapm.context.threadlocal as the backing.
2ebdf7c
to
58dc200
Compare
I think the closing/reopening might have messed up the appveyor integration. Will close and re-open in a new PR. |
…atched it (#454) * Execution context - use thread locals if gevent/eventlet has monkey patched it #453 * Extract out logic to decide which backing to use for execution_context into a function init_execution_context * Check if gevent or eventlet has monkey patched _threading.local, if it has then use elasticapm.context.threadlocal as the backing. closes #451
execution_context
into a functioninit_execution_context
gevent
oreventlet
has monkey patched_threading.local
, if it has then useelasticapm.context.threadlocal
as the backing.