-
Notifications
You must be signed in to change notification settings - Fork 21
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
No instrument / transaction decorators for async def
#633
Comments
Hi @bitdivision, I'm focused on #469 currently, but suspect this issue will be addressed as a part of that or soon after. Thanks, |
Just as an addendum, I found that using If it helps, I currently have the following decorator, which supports async / sync and defaults the operation unless it is specified. (This uses a get_tracked_request function which will need to be changed if used in the library. Also I don't think it'll be python2 compatible.)
|
@bitdivision do you have an example of the decorator not working properly for an async function? |
I don't have a specific example @tim-schilling but I had assumed it was not working properly for all async functions. I've forgotten the exact failure mode I was seeing. There's a python bug around this functionality where you have a sync ContextDecorator and want to decorate an async function: https://bugs.python.org/issue37398 |
Not a problem. I was able to break things and create a fix. I'm less inclined to try to use The new API will be something like: @instrument.async_("Foo")
async def foo(): |
Currently, the instrument and transaction decorators inherit from ContextDecorator which does not support decorating
async def
functions. Would be good to get an implementation which supports both.The text was updated successfully, but these errors were encountered: