Skip to content
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

Added aiohttp integration #1031

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

maciejmoskala
Copy link

Aiohttp integration to track async requests. Library way build based on opencensus-ext-requests and it was tested on real life environment.

@google-cla
Copy link

google-cla bot commented May 13, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label May 13, 2021
@maciejmoskala
Copy link
Author

@googlebot I signed it!

@google-cla
Copy link

google-cla bot commented May 13, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@maciejmoskala
Copy link
Author

@googlebot I fixed it.

@google-cla
Copy link

google-cla bot commented May 13, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@maciejmoskala
Copy link
Author

@aabmass @hectorhdzg @lzchen @songy23 What I should do to make this PR approved? Is there any flow I need to follow?

@maciejmoskala
Copy link
Author

@lzchen What should I do to make this PR to be added to project and to have package released?

- Added attributes following specs listed [here](https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md#attributes)
([#746](https://github.com/census-instrumentation/opencensus-python/pull/746))
- Support exporter changes in `opencensus>=0.7.0`
- Initial version
Copy link
Contributor

Choose a reason for hiding this comment

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

Please consolidate changes into one bullet point and hyperlink this PR.

@@ -0,0 +1,53 @@
OpenCensus requests Integration
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
OpenCensus requests Integration
OpenCensus aiohttp client Integration


::

pip install opencensus-ext-requests
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pip install opencensus-ext-requests
pip install opencensus-ext-aiohttp

Copy link
Member

@aabmass aabmass left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, and sorry for the slow response 😄 Since this won't work on 2.7 and potentially 3.{4,6}, you'll have to update tox.ini similar to what I did here https://github.com/census-instrumentation/opencensus-python/pull/1056/files#diff-ef2cef9f88b4fe09ca3082140e67f5ad34fb65fb6e228f119d3812261ae51449


You can enable aiohttp integration by specifying ``'aiohttp'`` to ``trace_integrations``.

It's possible to configure a list of URL you don't want traced, anf it's configurable by giving an array of
Copy link
Member

Choose a reason for hiding this comment

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

typo

@@ -0,0 +1,17 @@
# Copyright 2017, OpenCensus Authors
Copy link
Member

Choose a reason for hiding this comment

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

Can you update copyright years to 2021?

excludelist_hostnames = execution_context.get_opencensus_attr(
"excludelist_hostnames"
)
url_host_with_port = url.host + (f":{url.port}" if url.port else "")
Copy link
Member

Choose a reason for hiding this comment

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

Since f-strings are only since python3.6, this is probably breaking tests (we support back to 2.7)

"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
Copy link
Member

Choose a reason for hiding this comment

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

Does aiohttp not support 3.5 and 3.4?

"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
description="OpenCensus Requests Integration",
Copy link
Member

Choose a reason for hiding this comment

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

typo "requests"

async def test_wrap_session_request(self):
mock_tracer = MockTracer()
patch_tracer = mock.patch(
"opencensus.ext.requests.trace.execution_context." "get_opencensus_tracer",
Copy link
Member

Choose a reason for hiding this comment

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

typo "requests" in a few places in here

.. |pypi| image:: https://badge.fury.io/py/opencensus-ext-aiohttp.svg
:target: https://pypi.org/project/opencensus-ext-aiohttp/

OpenCensus can trace asynchronous HTTP requests made with the `aiohttp package`_. The request URL,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please mention somewhere explicitly that only Python versions 3.6+ are supported.

@lzchen
Copy link
Contributor

lzchen commented Aug 16, 2021

@maciejmoskala

Thanks for the contribution and sorry for the long wait in reviewing. In terms of integration contributions, we expect contributors to maintain this part of the codebase in the future. OpenCensus maintainers will assist when needed by the responsibility for maintaining, reviewing issues/PRs and releasing related to this integration falls on the contributor. Is this alright with you?

@polys
Copy link

polys commented Nov 29, 2021

Can I please ask if this is abandoned?

@lzchen
Copy link
Contributor

lzchen commented Nov 30, 2021

@maciejmoskala
Are you still working on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants