From 6ea107e354b6072110f2c2c8b183df5dc8ca7cff Mon Sep 17 00:00:00 2001 From: Owais Lone Date: Wed, 20 Oct 2021 17:49:32 +0530 Subject: [PATCH] Added asgiref depedency to opentelemetry-instrumentation-asgi opentelemetry-instrumentaiton-asgi does not contain an instrumentor for asgiref. Instead, it implements an ASGI middleware that other instrumentors import and use. As such, other instrumentors can take a dependency on this package without asgiref being installed locally. This commit adds `asgiref` as a dependency to the opentelemetry-instrumentation-asgi package so the middleware can function properly when used by another instrumentation. --- CHANGELOG.md | 4 ++++ instrumentation/README.md | 2 +- instrumentation/opentelemetry-instrumentation-asgi/setup.cfg | 1 + .../src/opentelemetry/instrumentation/asgi/package.py | 2 +- .../src/opentelemetry/instrumentation/bootstrap_gen.py | 5 +---- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9904b50a73..32d76f53ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.6.2-0.25b2...HEAD) +### Fixed + +- `opentelemetry-instrumentation-asgi` now explicitly depends on asgiref as it uses the package instead of instrumenting it. + ([#765](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/765)) ## [1.6.2-0.25b2](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.2-0.25b2) - 2021-10-19 diff --git a/instrumentation/README.md b/instrumentation/README.md index 84fdc2e8de..1e346f39ed 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -3,7 +3,7 @@ | --------------- | ------------------ | | [opentelemetry-instrumentation-aiohttp-client](./opentelemetry-instrumentation-aiohttp-client) | aiohttp ~= 3.0 | | [opentelemetry-instrumentation-aiopg](./opentelemetry-instrumentation-aiopg) | aiopg >= 0.13.0, < 1.3.0 | -| [opentelemetry-instrumentation-asgi](./opentelemetry-instrumentation-asgi) | asgiref ~= 3.0 | +| [opentelemetry-instrumentation-asgi](./opentelemetry-instrumentation-asgi) | asgi | | [opentelemetry-instrumentation-asyncpg](./opentelemetry-instrumentation-asyncpg) | asyncpg >= 0.12.0 | | [opentelemetry-instrumentation-boto](./opentelemetry-instrumentation-boto) | boto~=2.0 | | [opentelemetry-instrumentation-botocore](./opentelemetry-instrumentation-botocore) | botocore ~= 1.0 | diff --git a/instrumentation/opentelemetry-instrumentation-asgi/setup.cfg b/instrumentation/opentelemetry-instrumentation-asgi/setup.cfg index 4b4727242b..06468dafb5 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/setup.cfg +++ b/instrumentation/opentelemetry-instrumentation-asgi/setup.cfg @@ -43,6 +43,7 @@ install_requires = opentelemetry-semantic-conventions == 0.25b2 opentelemetry-instrumentation == 0.25b2 opentelemetry-util-http == 0.25b2 + asgiref ~= 3.0 [options.extras_require] test = diff --git a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/package.py b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/package.py index c219ec5499..7a66a17a93 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/package.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/package.py @@ -13,4 +13,4 @@ # limitations under the License. -_instruments = ("asgiref ~= 3.0",) +_instruments = tuple() diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index 2bf865116a..6830edcf02 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -24,10 +24,6 @@ "library": "aiopg >= 0.13.0, < 1.3.0", "instrumentation": "opentelemetry-instrumentation-aiopg==0.25b2", }, - "asgiref": { - "library": "asgiref ~= 3.0", - "instrumentation": "opentelemetry-instrumentation-asgi==0.25b2", - }, "asyncpg": { "library": "asyncpg >= 0.12.0", "instrumentation": "opentelemetry-instrumentation-asyncpg==0.25b2", @@ -134,6 +130,7 @@ }, } default_instrumentations = [ + "opentelemetry-instrumentation-asgi==0.25b2", "opentelemetry-instrumentation-dbapi==0.25b2", "opentelemetry-instrumentation-logging==0.25b2", "opentelemetry-instrumentation-sqlite3==0.25b2",