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

Support aio-pika v8 #1605

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Support aio-pika v8
([#1605](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1605))

### Added

- Add metric instrumentation for urllib
Expand Down
2 changes: 1 addition & 1 deletion docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pymemcache~=1.3
django>=2.2

# Required by instrumentation and exporter packages
aio_pika~=7.2.0
aio_pika>=7.2.0,<9.0.0
aiohttp~=3.0
aiopg>=0.13.0,<1.3.0
asyncpg>=0.12.0
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

| Instrumentation | Supported Packages | Metrics support |
| --------------- | ------------------ | --------------- |
| [opentelemetry-instrumentation-aio-pika](./opentelemetry-instrumentation-aio-pika) | aio_pika ~= 7.2.0 | No
| [opentelemetry-instrumentation-aio-pika](./opentelemetry-instrumentation-aio-pika) | aio_pika >= 7.2.0, < 9.0.0 | No
| [opentelemetry-instrumentation-aiohttp-client](./opentelemetry-instrumentation-aiohttp-client) | aiohttp ~= 3.0 | No
| [opentelemetry-instrumentation-aiopg](./opentelemetry-instrumentation-aiopg) | aiopg >= 0.13.0, < 2.0.0 | No
| [opentelemetry-instrumentation-asgi](./opentelemetry-instrumentation-asgi) | asgiref ~= 3.0 | No
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies = [

[project.optional-dependencies]
instruments = [
"aio_pika ~= 7.2.0",
"aio_pika >= 7.2.0, < 9.0.0",
]
test = [
"opentelemetry-instrumentation-aio-pika[instruments]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
from typing import Collection

_instruments: Collection[str] = ("aio_pika ~= 7.2.0",)
_instruments: Collection[str] = ("aio_pika >= 7.2.0, < 9.0.0",)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from typing import Type
from unittest import TestCase, mock

from aio_pika import Exchange, RobustExchange
from aio_pika import Exchange, RobustExchange, __version__
from packaging import version

from opentelemetry.instrumentation.aio_pika.publish_decorator import (
PublishDecorator,
Expand Down Expand Up @@ -54,7 +55,10 @@ def setUp(self):
asyncio.set_event_loop(self.loop)

def test_get_publish_span(self):
exchange = Exchange(CONNECTION, CHANNEL, EXCHANGE_NAME)
if version.parse(__version__) >= version.parse("8.0.0"):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The commit for this breaking change - mosquito/aio-pika@c2ee4be

exchange = Exchange(CHANNEL, EXCHANGE_NAME)
else:
exchange = Exchange(CONNECTION, CHANNEL, EXCHANGE_NAME)
tracer = mock.MagicMock()
PublishDecorator(tracer, exchange)._get_publish_span(
MESSAGE, ROUTING_KEY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

libraries = {
"aio_pika": {
"library": "aio_pika ~= 7.2.0",
"library": "aio_pika >= 7.2.0, < 9.0.0",
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.37b0.dev",
},
"aiohttp": {
Expand Down
11 changes: 7 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ envlist =
py3{7,8,9,10,11}-test-opentelemetry-instrumentation
pypy3-test-opentelemetry-instrumentation

py3{7,8,9,10,11}-test-instrumentation-aio-pika
pypy3-test-instrumentation-aio-pika
; opentelemetry-instrumentation-aio-pika
py3{7,8,9,10,11}-test-instrumentation-aio-pika{7,8}
pypy3-test-instrumentation-aio-pika{7,8}

; opentelemetry-instrumentation-aiohttp-client
py3{7,8,9,10,11}-test-instrumentation-aiohttp-client
Expand Down Expand Up @@ -250,6 +251,8 @@ deps =
sqlalchemy14: sqlalchemy~=1.4
pika0: pika>=0.12.0,<1.0.0
pika1: pika>=1.0.0
aio-pika7: aio-pika>=7.2.0,<8.0.0
aio-pika8: aio-pika>=8.0.0,<9.0.0
pymemcache135: pymemcache ==1.3.5
pymemcache200: pymemcache >2.0.0,<3.0.0
pymemcache300: pymemcache >3.0.0,<3.4.2
Expand All @@ -271,7 +274,7 @@ setenv =
changedir =
test-distro: opentelemetry-distro/tests
test-opentelemetry-instrumentation: opentelemetry-instrumentation/tests
test-instrumentation-aio-pika: instrumentation/opentelemetry-instrumentation-aio-pika/tests
test-instrumentation-aio-pika{7,8}: instrumentation/opentelemetry-instrumentation-aio-pika/tests
test-instrumentation-aiohttp-client: instrumentation/opentelemetry-instrumentation-aiohttp-client/tests
test-instrumentation-aiopg: instrumentation/opentelemetry-instrumentation-aiopg/tests
test-instrumentation-asgi: instrumentation/opentelemetry-instrumentation-asgi/tests
Expand Down Expand Up @@ -404,7 +407,7 @@ commands_pre =

logging: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-logging[test]

aio-pika: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika[test]
aio-pika{7,8}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika[test]

aiohttp-client: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-client[test]

Expand Down