Skip to content

implement support for asyncio [double-plus-WIP] #252

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

Closed
wants to merge 5 commits into from

Conversation

beniwohli
Copy link
Contributor

@beniwohli beniwohli commented Jul 9, 2018

DO NOT TRY THIS AT HOME JUST YET

Note: in the v2 API implementation PR, we removed the AsyncIOHTTPTransport. It might make sense to re-add it with this PR.

@beniwohli beniwohli force-pushed the async-poc branch 9 times, most recently from 362d36c to 228d980 Compare July 11, 2018 12:15
if sys.version_info >= (3, 5):
from elasticapm.contrib.asyncio.traces import async_capture_span as capture_span # noqa: F401
else:
from elasticapm.traces import capture_span # noqa: F401

Choose a reason for hiding this comment

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

at least two spaces before inline comment

from elasticapm.traces import set_transaction_name, set_user_context, tag # noqa: F401
from elasticapm.traces import set_transaction_result # noqa: F401

if sys.version_info >= (3, 5):
from elasticapm.contrib.asyncio.traces import async_capture_span as capture_span # noqa: F401

Choose a reason for hiding this comment

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

at least two spaces before inline comment


if sys.version_info >= (3, 5):
from elasticapm.contrib.asyncio.traces import async_capture_span # noqa: F401

Choose a reason for hiding this comment

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

blank line at end of file

@@ -23,3 +24,7 @@
from elasticapm.traces import capture_span, set_context, set_custom_context # noqa: F401
from elasticapm.traces import set_transaction_name, set_user_context, tag # noqa: F401
from elasticapm.traces import set_transaction_result # noqa: F401

if sys.version_info >= (3, 5):
from elasticapm.contrib.asyncio.traces import async_capture_span # noqa: F401

Choose a reason for hiding this comment

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

'elasticapm.contrib.asyncio.traces.async_capture_span' imported but unused
at least two spaces before inline comment
inline comment should start with '# '

@ciarancourtney
Copy link

@beniwohli can you rebase against master when you can, I'd like to test this on twisted

this allows us to defer the costly frame processing until the end of the
span, at which time we can discard it if span time threshold hasn't been
reached

Signed-off-by: Benjamin Wohlwend <[email protected]>
this allows the use of `async_capture_span` as an async decorator

Signed-off-by: Benjamin Wohlwend <[email protected]>
Signed-off-by: Benjamin Wohlwend <[email protected]>
@beniwohli
Copy link
Contributor Author

@ciarancourtney done :) let me know how it goes!

@ciarancourtney
Copy link

Sorry I misunderstood the PR, I thought it added support for twisted. FYI I'm using 3.0.1 just fine for a twisted/thrift based RPC server using the public API

beniwohli added a commit to beniwohli/apm-agent-python that referenced this pull request Sep 20, 2018
…locals

this is a partial "import" of the asyncio work done in elastic#252, sans the
asyncio specific extensions
beniwohli added a commit that referenced this pull request Sep 20, 2018
…locals (#291)

this is a partial "import" of the asyncio work done in #252, sans the
asyncio specific extensions

closes #291
beniwohli added a commit that referenced this pull request Oct 5, 2018
…locals (#291)

this is a partial "import" of the asyncio work done in #252, sans the
asyncio specific extensions

closes #291
beniwohli added a commit to beniwohli/apm-agent-python that referenced this pull request Oct 18, 2018
…locals (elastic#291)

this is a partial "import" of the asyncio work done in elastic#252, sans the
asyncio specific extensions

closes elastic#291
@menecio
Copy link

menecio commented Aug 9, 2019

Hi, do you still plan to release this?

@approxit
Copy link

approxit commented Aug 9, 2019

@menecio I think that this MR is a bit outdated and not closed... Support for asyncio was added in v4 of apt-agent-python.

@beniwohli
Copy link
Contributor Author

@approxit unfortunately, that is not quite correct. We did merge some preliminary support for asyncio in 4.0 (like the usage of contextvars), but some work still remains to get proper support. I hope to get to this is in the coming few months.

@beniwohli
Copy link
Contributor Author

Closing this, as most parts have been merged or are in the process of being merged in other PRs. Progress on asyncio can be tracked in #598

@beniwohli beniwohli closed this Nov 26, 2019
@beniwohli beniwohli deleted the async-poc branch November 26, 2019 15:08
@zube zube bot removed the [zube]: Done label Oct 13, 2020
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.

6 participants