From aa8ae2efe34f049088eb517c5c87ed1f943a4704 Mon Sep 17 00:00:00 2001 From: Markus Date: Thu, 14 Mar 2024 09:50:04 +0100 Subject: [PATCH 01/17] Celery duplicated instrumentation (#2342) * * Adding (failing) testcase to cover Issue #2029 * * move Instance variables to class variables. Since the object in question will be a singelton. This will resolve #2029 where multiple calls to the instrumentation will assign Null values. * * black formatting * * Changelog stub entry, PR # to follow * * updating the pullrequest number * * remove superfluous constructor * * moving Change log to unreleased section --------- Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com> --- CHANGELOG.md | 2 ++ .../instrumentation/celery/__init__.py | 6 ++-- .../tests/test_duplicate.py | 30 +++++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-celery/tests/test_duplicate.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e841a0bdc8..673623d89c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Fixed +- `opentelemetry-instrumentation-celery` Allow Celery instrumentation to be installed multiple times + ([#2342](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2342)) - Align gRPC span status codes to OTEL specification ([#1756](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1756)) ## Version 1.23.0/0.44b0 (2024-02-23) diff --git a/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py b/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py index 94cac68b70..10ccca1270 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py @@ -113,10 +113,8 @@ def keys(self, carrier): class CeleryInstrumentor(BaseInstrumentor): - def __init__(self): - super().__init__() - self.metrics = None - self.task_id_to_start_time = {} + metrics = None + task_id_to_start_time = {} def instrumentation_dependencies(self) -> Collection[str]: return _instruments diff --git a/instrumentation/opentelemetry-instrumentation-celery/tests/test_duplicate.py b/instrumentation/opentelemetry-instrumentation-celery/tests/test_duplicate.py new file mode 100644 index 0000000000..ab1f7804cf --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-celery/tests/test_duplicate.py @@ -0,0 +1,30 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest + +from opentelemetry.instrumentation.celery import CeleryInstrumentor + + +class TestUtils(unittest.TestCase): + def test_duplicate_instrumentaion(self): + first = CeleryInstrumentor() + first.instrument() + second = CeleryInstrumentor() + second.instrument() + CeleryInstrumentor().uninstrument() + self.assertIsNotNone(first.metrics) + self.assertIsNotNone(second.metrics) + self.assertEqual(first.task_id_to_start_time, {}) + self.assertEqual(second.task_id_to_start_time, {}) From af1528d2884dbdfa080845260750c40d50427dd8 Mon Sep 17 00:00:00 2001 From: Rodrigo-Novas Date: Thu, 14 Mar 2024 06:36:54 -0300 Subject: [PATCH 02/17] chore: fix md based on rules and fix bad links (#2240) * chore: fix md based on rules and fix bad links * chore: add index to contribuiting and readme files --------- Co-authored-by: Leighton Chen Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com> --- CONTRIBUTING.md | 57 ++++++++++++++++++++++++++++++++----------------- README.md | 17 +++++++++++---- RELEASING.md | 6 ++++-- 3 files changed, 54 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7c76634db7..0c18392bc7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,26 @@ on how to become a [**Member**](https://github.com/open-telemetry/community/blob [**Approver**](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver) and [**Maintainer**](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer). -## Find a Buddy and get Started Quickly! +## Index + +* [Find a Buddy and get Started Quickly](#find-a-buddy-and-get-started-quickly) +* [Development](#development) + * [Troubleshooting](#troubleshooting) + * [Benchmarks](#benchmarks) +* [Pull requests](#pull-requests) + * [How to Send Pull Requests](#how-to-send-pull-requests) + * [How to Receive Comments](#how-to-receive-comments) + * [How to Get PRs Reviewed](#how-to-get-prs-reviewed) + * [How to Get PRs Merged](#how-to-get-prs-merged) +* [Design Choices](#design-choices) + * [Focus on Capabilities, Not Structure Compliance](#focus-on-capabilities-not-structure-compliance) +* [Running Tests Locally](#running-tests-locally) + * [Testing against a different Core repo branch/commit](#testing-against-a-different-core-repo-branchcommit) +* [Style Guide](#style-guide) +* [Guideline for instrumentations](#guideline-for-instrumentations) +* [Expectations from contributors](#expectations-from-contributors) + +## Find a Buddy and get Started Quickly If you are looking for someone to help you find a starting point and be a resource for your first contribution, join our Slack and find a buddy! @@ -31,8 +50,8 @@ This project uses [tox](https://tox.readthedocs.io) to automate some aspects of development, including testing against multiple Python versions. To install `tox`, run: -```console -$ pip install tox +```sh +pip install tox ``` You can run `tox` with the following arguments: @@ -57,7 +76,7 @@ for more detail on available tox commands. ### Troubleshooting -- Some packages may require additional system wide dependencies to be installed. For example, you may need to install `libpq-dev` to run the postgresql client libraries instrumentation tests. or `libsnappy-dev` to run the prometheus exporter tests. If you encounter a build error, please check the installation instructions for the package you are trying to run tests for. +> Some packages may require additional system wide dependencies to be installed. For example, you may need to install `libpq-dev` to run the postgresql client libraries instrumentation tests. or `libsnappy-dev` to run the prometheus exporter tests. If you encounter a build error, please check the installation instructions for the package you are trying to run tests for. ### Benchmarks @@ -94,13 +113,13 @@ pull requests (PRs). To create a new PR, fork the project in GitHub and clone the upstream repo: ```sh -$ git clone https://github.com/open-telemetry/opentelemetry-python-contrib.git +git clone https://github.com/open-telemetry/opentelemetry-python-contrib.git ``` Add your fork as an origin: ```sh -$ git remote add fork https://github.com/YOUR_GITHUB_USERNAME/opentelemetry-python-contrib.git +git remote add fork https://github.com/YOUR_GITHUB_USERNAME/opentelemetry-python-contrib.git ``` Run tests: @@ -114,10 +133,10 @@ $ tox # execute in the root of the repository Check out a new branch, make modifications and push the branch to your fork: ```sh -$ git checkout -b feature +git checkout -b feature # edit files -$ git commit -$ git push fork feature +git commit +git push fork feature ``` Open a pull request against the main `opentelemetry-python-contrib` repo. @@ -142,6 +161,7 @@ If you are not getting reviews, please contact the respective owners directly. ### How to Get PRs Merged A PR is considered to be **ready to merge** when: + * It has received two approvals from [Approvers](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver) / [Maintainers](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer) (at different companies). @@ -186,8 +206,7 @@ Some of the tox targets install packages from the [OpenTelemetry Python Core Rep CORE_REPO_SHA=c49ad57bfe35cfc69bfa863d74058ca9bec55fc3 tox -The continuation integration overrides that environment variable with as per the configuration [here](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/workflows/test.yml#L9). - +The continuation integration overrides that environment variable with as per the configuration [here](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/.github/workflows/test.yml#L9). ## Style Guide @@ -203,27 +222,25 @@ Below is a checklist of things to be mindful of when implementing a new instrume - Follow semantic conventions - The instrumentation should follow the semantic conventions defined [here](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/semantic-conventions.md) -- Extends from [BaseInstrumentor](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py#L26) +- Extends from [BaseInstrumentor](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/2518a4ac07cb62ad6587dd8f6cbb5f8663a7e179/opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py#L35) - Supports auto-instrumentation - - Add an entry point (ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/f045c43affff6ff1af8fa2f7514a4fdaca97dacf/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml#L44) + - Add an entry point (ex. ) - Run `python scripts/generate_instrumentation_bootstrap.py` after adding a new instrumentation package. - Functionality that is common amongst other instrumentation and can be abstracted [here](https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation/src/opentelemetry/instrumentation) - Request/response [hooks](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/408) for http instrumentations - `suppress_instrumentation` functionality - - ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/3ec77360cb20482b08b30312a6bedc8b946e3fa1/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L111 + - ex. - Suppress propagation functionality - https://github.com/open-telemetry/opentelemetry-python-contrib/issues/344 for more context - `exclude_urls` functionality - - ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0fcb60d2ad139f78a52edd85b1cc4e32f2e962d0/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py#L91 + - ex. - `url_filter` functionality - - ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0fcb60d2ad139f78a52edd85b1cc4e32f2e962d0/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py#L235 + - ex. - `is_recording()` optimization on non-sampled spans - - ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L133 + - ex. - Appropriate error handling - - ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L146 - + - ex. ## Expectations from contributors OpenTelemetry is an open source community, and as such, greatly encourages contributions from anyone interested in the project. With that being said, there is a certain level of expectation from contributors even after a pull request is merged, specifically pertaining to instrumentations. The OpenTelemetry Python community expects contributors to maintain a level of support and interest in the instrumentations they contribute. This is to ensure that the instrumentation does not become stale and still functions the way the original contributor intended. Some instrumentations also pertain to libraries that the current members of the community are not so familiar with, so it is necessary to rely on the expertise of the original contributing parties. - diff --git a/README.md b/README.md index 0a3d37ab3f..c315b4a876 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,20 @@ --- -## OpenTelemetry Python Contrib +# OpenTelemetry Python Contrib The Python auto-instrumentation libraries for [OpenTelemetry](https://opentelemetry.io/) (per [OTEP 0001](https://github.com/open-telemetry/oteps/blob/main/text/0001-telemetry-without-manual-instrumentation.md)) -### Installation +## Index + +* [Installation](#installation) +* [Releasing](#releasing) + * [Releasing a package as `1.0` stable](#releasing-a-package-as-10-stable) +* [Contributing](#contributing) +* [Running Tests Locally](#running-tests-locally) +* [Thanks to all the people who already contributed](#thanks-to-all-the-people-who-already-contributed) + +## Installation This repository includes installable packages for each instrumented library. Libraries that produce telemetry data should only depend on `opentelemetry-api`, and defer the choice of the SDK to the application developer. Applications may @@ -79,6 +88,7 @@ To resolve this, members of the community are encouraged to commit to becoming a ### Releasing a package as `1.0` stable To release a package as `1.0` stable, the package: + - SHOULD have a CODEOWNER. To become one, submit an issue and explain why you meet the responsibilities found in [CODEOWNERS](.github/CODEOWNERS). - MUST have unit tests that cover all supported versions of the instrumented library. - e.g. Instrumentation packages might use different techniques to instrument different major versions of python packages @@ -131,9 +141,8 @@ Emeritus Maintainers: 4. Make sure you have `tox` installed. `pip install tox`. 5. Run tests for a package. (e.g. `tox -e test-instrumentation-flask`.) -### Thanks to all the people who already contributed! +### Thanks to all the people who already contributed - diff --git a/RELEASING.md b/RELEASING.md index 1547cec224..256674d1b8 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -77,15 +77,17 @@ * If for some reason the action failed, see [Publish failed](#publish-failed) below * Move stable tag * Run the following (TODO automate): + ```bash git tag -d stable git tag stable git push --delete origin tagname git push origin stable ``` + * This will ensure the docs are pointing at the stable release. * To validate this worked, ensure the stable build has run successfully: - https://readthedocs.org/projects/opentelemetry-python/builds/. + . If the build has not run automatically, it can be manually trigger via the readthedocs interface. ## Troubleshooting @@ -98,4 +100,4 @@ If for some reason the action failed, do it manually: - Build distributions with `./scripts/build.sh` - Delete distributions we don't want to push (e.g. `testutil`) - Push to PyPI as `twine upload --skip-existing --verbose dist/*` -- Double check PyPI! \ No newline at end of file +- Double check PyPI! From 9b3d0b485e444366ae7b98a030489e40be099402 Mon Sep 17 00:00:00 2001 From: John Bley Date: Thu, 14 Mar 2024 13:29:38 -0400 Subject: [PATCH 03/17] Use set -e to catch errors in all scripts (#2347) --- .../proto/generate-proto-py.sh | 1 + scripts/prepare_release.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/exporter/opentelemetry-exporter-prometheus-remote-write/proto/generate-proto-py.sh b/exporter/opentelemetry-exporter-prometheus-remote-write/proto/generate-proto-py.sh index 3cde0bd1ac..5f6129df55 100755 --- a/exporter/opentelemetry-exporter-prometheus-remote-write/proto/generate-proto-py.sh +++ b/exporter/opentelemetry-exporter-prometheus-remote-write/proto/generate-proto-py.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e PROM_VERSION=v2.39.0 PROTO_VERSION=v1.3.2 diff --git a/scripts/prepare_release.sh b/scripts/prepare_release.sh index a0bb15f216..66ed3c593e 100755 --- a/scripts/prepare_release.sh +++ b/scripts/prepare_release.sh @@ -1,5 +1,6 @@ #!/bin/bash -# +set -e + # This script: # 1. parses the version number from the branch name # 2. updates version.py files to match that version From 3273d8c39f289e2c9350ae781406dfb99692bb76 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 14 Mar 2024 20:27:18 +0100 Subject: [PATCH 04/17] Fix asyncio related warnings in tests (#2335) * aiopg: fix runtime warnings when running tests Fixes: RuntimeWarning: coroutine 'MockCursor.execute' was never awaited cursor.execute(query) * aio-pika: no need to return an awaitable in mocked method No need to return an awaitable since the mocked method awaits itself. Fixes: RuntimeWarning: coroutine 'sleep' was never awaited --------- Co-authored-by: Leighton Chen --- .../tests/test_publish_decorator.py | 16 ++++------------ .../tests/test_aiopg_integration.py | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py b/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py index 41cd11d5a6..90a029531d 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py @@ -75,9 +75,7 @@ def _test_publish(self, exchange_type: Type[Exchange]): with mock.patch.object( PublishDecorator, "_get_publish_span" ) as mock_get_publish_span: - with mock.patch.object( - Exchange, "publish", return_value=asyncio.sleep(0) - ) as mock_publish: + with mock.patch.object(Exchange, "publish") as mock_publish: decorated_publish = PublishDecorator( self.tracer, exchange ).decorate(mock_publish) @@ -101,9 +99,7 @@ def _test_publish_works_with_not_recording_span(self, exchange_type): mocked_not_recording_span = MagicMock() mocked_not_recording_span.is_recording.return_value = False mock_get_publish_span.return_value = mocked_not_recording_span - with mock.patch.object( - Exchange, "publish", return_value=asyncio.sleep(0) - ) as mock_publish: + with mock.patch.object(Exchange, "publish") as mock_publish: with mock.patch( "opentelemetry.instrumentation.aio_pika.publish_decorator.propagate.inject" ) as mock_inject: @@ -158,9 +154,7 @@ def _test_publish(self, exchange_type: Type[Exchange]): with mock.patch.object( PublishDecorator, "_get_publish_span" ) as mock_get_publish_span: - with mock.patch.object( - Exchange, "publish", return_value=asyncio.sleep(0) - ) as mock_publish: + with mock.patch.object(Exchange, "publish") as mock_publish: decorated_publish = PublishDecorator( self.tracer, exchange ).decorate(mock_publish) @@ -184,9 +178,7 @@ def _test_publish_works_with_not_recording_span(self, exchange_type): mocked_not_recording_span = MagicMock() mocked_not_recording_span.is_recording.return_value = False mock_get_publish_span.return_value = mocked_not_recording_span - with mock.patch.object( - Exchange, "publish", return_value=asyncio.sleep(0) - ) as mock_publish: + with mock.patch.object(Exchange, "publish") as mock_publish: with mock.patch( "opentelemetry.instrumentation.aio_pika.publish_decorator.propagate.inject" ) as mock_inject: diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py b/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py index c6d00a51fe..fb76bd0f38 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py @@ -76,7 +76,7 @@ def test_instrumentor_connect(self): cnx = async_call(aiopg.connect(database="test")) cursor = async_call(cnx.cursor()) query = "SELECT * FROM test" - cursor.execute(query) + async_call(cursor.execute(query)) spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 1) @@ -127,7 +127,7 @@ def test_instrumentor_create_pool(self): cnx = async_call(pool.acquire()) cursor = async_call(cnx.cursor()) query = "SELECT * FROM test" - cursor.execute(query) + async_call(cursor.execute(query)) spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 1) From 717d10760ad1731fe59673a3b26c5e645bb6e1c3 Mon Sep 17 00:00:00 2001 From: Rodrigo-Novas Date: Thu, 14 Mar 2024 18:56:32 -0300 Subject: [PATCH 05/17] feat: add importlib metadata default on flask module (#2302) * feat: add importlib metadata default * feat: add importlib metadata default * feat: add importlib metadata default * Fix lint --------- Co-authored-by: Diego Hurtado --- CHANGELOG.md | 7 +++++-- .../pyproject.toml | 1 + .../opentelemetry/instrumentation/flask/__init__.py | 13 +++---------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 673623d89c..7bbe579232 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - `opentelemetry-instrumentation-celery` Allow Celery instrumentation to be installed multiple times ([#2342](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2342)) -- Align gRPC span status codes to OTEL specification ([#1756](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1756)) +- Align gRPC span status codes to OTEL specification + ([#1756](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1756)) +- `opentelemetry-instrumentation-flask` Add importlib metadata default for deprecation warning flask version + ([#2297](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2297)) ## Version 1.23.0/0.44b0 (2024-02-23) -- Drop support for 3.7 +- Drop uspport for 3.7 ([#2151](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2151)) - `opentelemetry-resource-detector-azure` Added 10s timeout to VM Resource Detector ([#2119](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2119)) diff --git a/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml b/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml index ca26f4c860..c8e8b48185 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml @@ -30,6 +30,7 @@ dependencies = [ "opentelemetry-semantic-conventions == 0.45b0.dev", "opentelemetry-util-http == 0.45b0.dev", "packaging >= 21.0", + "importlib-metadata >= 4.0", ] [project.optional-dependencies] diff --git a/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py b/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py index 5e81cc5abe..a2b85d67f8 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py @@ -245,22 +245,13 @@ def response_hook(span: Span, status: str, response_headers: List): from typing import Collection import flask +import importlib_metadata as metadata from packaging import version as package_version import opentelemetry.instrumentation.wsgi as otel_wsgi from opentelemetry import context, trace from opentelemetry.instrumentation.flask.package import _instruments from opentelemetry.instrumentation.flask.version import __version__ - -try: - flask_version = flask.__version__ -except AttributeError: - try: - from importlib import metadata - except ImportError: - import importlib_metadata as metadata - flask_version = metadata.version("flask") - from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.propagators import ( get_global_response_propagator, @@ -281,6 +272,8 @@ def response_hook(span: Span, status: str, response_headers: List): _excluded_urls_from_env = get_excluded_urls("FLASK") +flask_version = metadata.version("flask") + if package_version.parse(flask_version) >= package_version.parse("2.2.0"): def _request_ctx_ref() -> weakref.ReferenceType: From 5b4e5d810ab36f08977579a76804472d58f9850a Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 17:43:20 -0600 Subject: [PATCH 06/17] Remove [test] package from opentelemetry-contrib-instrumentations (#2318) Fixes #2236 --- opentelemetry-contrib-instrumentations/pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/opentelemetry-contrib-instrumentations/pyproject.toml b/opentelemetry-contrib-instrumentations/pyproject.toml index 2ed7ccec87..1cd2c37625 100644 --- a/opentelemetry-contrib-instrumentations/pyproject.toml +++ b/opentelemetry-contrib-instrumentations/pyproject.toml @@ -77,9 +77,6 @@ dependencies = [ "opentelemetry-instrumentation-wsgi==0.45b0.dev", ] -[project.optional-dependencies] -test = [] - [project.urls] Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-contrib-instrumentations" From c54a9d1ad2436ce363df4680f3ec83369c98e5c9 Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 17:57:38 -0600 Subject: [PATCH 07/17] Remove [test] package from aiopg instrumentation (#2243) Fixes #2185 --- .../pyproject.toml | 5 ----- .../test-requirements.txt | 22 +++++++++++++++++++ tox.ini | 6 ++--- 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml b/instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml index ebb88ee0ba..b6c54b658b 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml @@ -34,11 +34,6 @@ dependencies = [ instruments = [ "aiopg >= 0.13.0, < 2.0.0", ] -test = [ - "opentelemetry-instrumentation-aiopg[instruments]", - "opentelemetry-semantic-conventions == 0.45b0.dev", - "opentelemetry-test-utils == 0.45b0.dev", -] [project.entry-points.opentelemetry_instrumentor] aiopg = "opentelemetry.instrumentation.aiopg:AiopgInstrumentor" diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt new file mode 100644 index 0000000000..2b03677f42 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt @@ -0,0 +1,22 @@ +aiopg==1.4.0 +asgiref==3.7.2 +async-timeout==4.0.3 +attrs==23.2.0 +Deprecated==1.2.14 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +install==1.3.5 +packaging==23.2 +pluggy==1.4.0 +psycopg2-binary==2.9.9 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-dbapi +-e instrumentation/opentelemetry-instrumentation-aiopg diff --git a/tox.ini b/tox.ini index 6d74b45964..936ee920a7 100644 --- a/tox.ini +++ b/tox.ini @@ -406,7 +406,7 @@ commands_pre = aiohttp-server: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-server[test] - aiopg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aiopg[test] + aiopg: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt richconsole: pip install flaky {toxinidir}/exporter/opentelemetry-exporter-richconsole[test] @@ -563,7 +563,7 @@ commands_pre = python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-client[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-server[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-aiopg[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlite3[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-pyramid[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-requests[test] @@ -597,7 +597,7 @@ commands = [testenv:docker-tests] basepython: python3 deps = - aiopg==1.1.0 + aiopg==1.4.0 amqp==5.2.0 asgiref==3.7.2 async-timeout==4.0.3 From 2417c099a0172717cc2929fda5892e37ebac461b Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 18:07:12 -0600 Subject: [PATCH 08/17] Remove [test] package from aio-pika instrumentation (#2244) Fixes #2186 --- .../pyproject.toml | 6 ----- .../test-requirements-0.txt | 23 +++++++++++++++++++ .../test-requirements-1.txt | 23 +++++++++++++++++++ .../test-requirements-2.txt | 23 +++++++++++++++++++ tox.ini | 20 ++++++++-------- 5 files changed, 80 insertions(+), 15 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt create mode 100644 instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt create mode 100644 instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml b/instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml index f328eab452..e79dac2866 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml @@ -33,12 +33,6 @@ dependencies = [ instruments = [ "aio_pika >= 7.2.0, < 10.0.0", ] -test = [ - "opentelemetry-instrumentation-aio-pika[instruments]", - "opentelemetry-test-utils == 0.45b0.dev", - "pytest", - "wrapt >= 1.0.0, < 2.0.0", -] [project.entry-points.opentelemetry_instrumentor] aio-pika = "opentelemetry.instrumentation.aio_pika:AioPikaInstrumentor" diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt new file mode 100644 index 0000000000..c8ffea4e89 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt @@ -0,0 +1,23 @@ +aio-pika==7.2.0 +aiormq==6.2.3 +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +idna==3.6 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +multidict==6.0.5 +packaging==23.2 +pamqp==3.1.0 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +wrapt==1.16.0 +yarl==1.9.4 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-aio-pika diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt new file mode 100644 index 0000000000..1e2ea5a1e5 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt @@ -0,0 +1,23 @@ +aio-pika==8.3.0 +aiormq==6.6.4 +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +idna==3.6 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +multidict==6.0.5 +packaging==23.2 +pamqp==3.2.1 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +wrapt==1.16.0 +yarl==1.9.4 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-aio-pika diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt new file mode 100644 index 0000000000..3250c93947 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt @@ -0,0 +1,23 @@ +aio-pika==9.4.0 +aiormq==6.8.0 +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +idna==3.6 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +multidict==6.0.5 +packaging==23.2 +pamqp==3.3.0 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +wrapt==1.16.0 +yarl==1.9.4 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-aio-pika diff --git a/tox.ini b/tox.ini index 936ee920a7..5b7fe73aa8 100644 --- a/tox.ini +++ b/tox.ini @@ -223,8 +223,13 @@ envlist = pypy3-test-instrumentation-sio-pika-{0,1} ; opentelemetry-instrumentation-aio-pika - py3{8,9,10,11}-test-instrumentation-aio-pika-{8,9} - pypy3-test-instrumentation-aio-pika-{8,9} + ; The numbers at the end of the environment names + ; below mean these dependencies are being used: + ; 0: aio_pika~=7.2.0 + ; 1: aio_pika>=8.0.0,<9.0.0 + ; 2: aio_pika>=9.0.0,<10.0.0 + py3{8,9,10,11}-test-instrumentation-aio-pika-{0,1,2} + pypy3-test-instrumentation-aio-pika-{0,1,2} ; opentelemetry-instrumentation-kafka-python py3{8,9,10,11}-test-instrumentation-kafka-python @@ -284,9 +289,6 @@ deps = sqlalchemy-14: sqlalchemy~=1.4 sio-pika-0: pika>=0.12.0,<1.0.0 sio-pika-1: pika>=1.0.0 - aio-pika-7: aio_pika~=7.2.0 - aio-pika-8: aio_pika>=8.0.0,<9.0.0 - aio-pika-9: aio_pika>=9.0.0,<10.0.0 pymemcache-135: pymemcache ==1.3.5 pymemcache-200: pymemcache >2.0.0,<3.0.0 pymemcache-300: pymemcache >3.0.0,<3.4.2 @@ -325,7 +327,9 @@ commands_pre = sio-pika-{0,1}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-pika[test] - aio-pika-{8,9}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika[test] + aio-pika-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt + aio-pika-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt + aio-pika-2: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt kafka-python: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-kafka-python[test] @@ -400,8 +404,6 @@ commands_pre = logging: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-logging[test] - aio-pika-{8,9}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika[test] - aiohttp-client: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-client[test] aiohttp-server: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-server[test] @@ -549,7 +551,7 @@ commands_pre = python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-cassandra[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-celery[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-pika[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt ; python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-sklearn[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-redis[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-remoulade[test] From 1bf9f429e4b8b710762f06cb3a8e738e1fe76667 Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 18:18:52 -0600 Subject: [PATCH 09/17] Remove [test] package from asgi instrumentation (#2247) Fixes #2187 --- .../pyproject.toml | 4 ---- .../test-requirements.txt | 18 ++++++++++++++++++ tox.ini | 8 +++++--- 3 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt diff --git a/instrumentation/opentelemetry-instrumentation-asgi/pyproject.toml b/instrumentation/opentelemetry-instrumentation-asgi/pyproject.toml index d642a07e48..81c83b07e9 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-asgi/pyproject.toml @@ -35,10 +35,6 @@ dependencies = [ instruments = [ "asgiref ~= 3.0", ] -test = [ - "opentelemetry-instrumentation-asgi[instruments]", - "opentelemetry-test-utils == 0.45b0.dev", -] [project.urls] Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-asgi" diff --git a/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt new file mode 100644 index 0000000000..f3ee9764cf --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt @@ -0,0 +1,18 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-asgi diff --git a/tox.ini b/tox.ini index 5b7fe73aa8..6e18132202 100644 --- a/tox.ini +++ b/tox.ini @@ -323,6 +323,8 @@ commands_pre = distro: pip install {toxinidir}/opentelemetry-distro + asgi: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt + celery: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-celery[test] sio-pika-{0,1}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-pika[test] @@ -337,9 +339,9 @@ commands_pre = grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] - falcon-{1,2,3},flask-{213,220,300},django-{1,2,3,4},pyramid,tornado,starlette,fastapi,aiohttp,asgi,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http + falcon-{1,2,3},flask-{213,220,300},django-{1,2,3,4},pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http wsgi,falcon-{1,2,3},flask-{213,220,300},django-{1,2,3,4},pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] - asgi,django-{3,4},starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi[test] + django-{3,4},starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi asyncpg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg[test] @@ -538,7 +540,7 @@ commands_pre = python -m pip install -e {toxinidir}/opentelemetry-instrumentation[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-botocore[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-boto3sqs[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-django[test] From 5552db2adfbd18fd3232dee8047d366a19d4df7b Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 18:32:23 -0600 Subject: [PATCH 10/17] Remove [test] package from asyncio instrumentation (#2248) Fixes #2188 --- .../pyproject.toml | 6 ------ .../test-requirements.txt | 18 ++++++++++++++++++ tox.ini | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt diff --git a/instrumentation/opentelemetry-instrumentation-asyncio/pyproject.toml b/instrumentation/opentelemetry-instrumentation-asyncio/pyproject.toml index 358fbefeb4..5354ea3cb4 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncio/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-asyncio/pyproject.toml @@ -33,12 +33,6 @@ dependencies = [ [project.optional-dependencies] instruments = [] -test = [ - "opentelemetry-instrumentation-asyncio[instruments]", - "pytest", - "wrapt >= 1.0.0, < 2.0.0", - "pytest-asyncio", -] [project.entry-points.opentelemetry_instrumentor] asyncio = "opentelemetry.instrumentation.asyncio:AsyncioInstrumentor" diff --git a/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt new file mode 100644 index 0000000000..14f724888b --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt @@ -0,0 +1,18 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-asyncio==0.23.5 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-asyncio diff --git a/tox.ini b/tox.ini index 6e18132202..3250a5be3c 100644 --- a/tox.ini +++ b/tox.ini @@ -422,7 +422,7 @@ commands_pre = elasticsearch-{2,5,6}: pip install {toxinidir}/opentelemetry-instrumentation[test] {toxinidir}/instrumentation/opentelemetry-instrumentation-elasticsearch[test] - asyncio: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncio[test] + asyncio: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt httpx-{18,21}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-httpx[test] @@ -586,7 +586,7 @@ commands_pre = python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-httpx[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-aws-lambda[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-system-metrics[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncio[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt python -m pip install -e {toxinidir}/exporter/opentelemetry-exporter-richconsole[test] # requires snappy headers to be available on the system python -m pip install -e {toxinidir}/sdk-extension/opentelemetry-sdk-extension-aws[test] From d948f21ad32fb9fde0b1193abc1b7acf28539d4a Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 18:42:46 -0600 Subject: [PATCH 11/17] Remove [test] package from flask instrumentation (#2127) Fixes #2126 --- .../pyproject.toml | 5 ---- .../test-requirements-0.txt | 25 +++++++++++++++++ .../test-requirements-1.txt | 25 +++++++++++++++++ .../test-requirements-2.txt | 26 ++++++++++++++++++ tox.ini | 27 ++++++++++--------- 5 files changed, 90 insertions(+), 18 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt create mode 100644 instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt create mode 100644 instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt diff --git a/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml b/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml index c8e8b48185..8e0dd1f858 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml @@ -37,11 +37,6 @@ dependencies = [ instruments = [ "flask >= 1.0", ] -test = [ - "opentelemetry-instrumentation-flask[instruments]", - "markupsafe==2.1.2", - "opentelemetry-test-utils == 0.45b0.dev", -] [project.entry-points.opentelemetry_instrumentor] flask = "opentelemetry.instrumentation.flask:FlaskInstrumentor" diff --git a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt new file mode 100644 index 0000000000..fbefeebdb4 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt @@ -0,0 +1,25 @@ +asgiref==3.7.2 +attrs==23.2.0 +click==8.1.7 +Deprecated==1.2.14 +Flask==2.1.3 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +itsdangerous==2.1.2 +Jinja2==3.1.3 +MarkupSafe==2.1.2 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +Werkzeug==2.3.8 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-flask diff --git a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt new file mode 100644 index 0000000000..41583ad7f9 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt @@ -0,0 +1,25 @@ +asgiref==3.7.2 +attrs==23.2.0 +click==8.1.7 +Deprecated==1.2.14 +Flask==2.2.0 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +itsdangerous==2.1.2 +Jinja2==3.1.3 +MarkupSafe==2.1.2 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +Werkzeug==2.3.8 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-flask diff --git a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt new file mode 100644 index 0000000000..3a89328861 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt @@ -0,0 +1,26 @@ +asgiref==3.7.2 +attrs==23.2.0 +blinker==1.7.0 +click==8.1.7 +Deprecated==1.2.14 +Flask==3.0.2 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +itsdangerous==2.1.2 +Jinja2==3.1.3 +MarkupSafe==2.1.2 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +Werkzeug==3.0.1 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-flask diff --git a/tox.ini b/tox.ini index 3250a5be3c..d61f050571 100644 --- a/tox.ini +++ b/tox.ini @@ -83,9 +83,14 @@ envlist = pypy3-test-instrumentation-fastapi ; opentelemetry-instrumentation-flask - py3{8,9,10,11}-test-instrumentation-flask-{213,220} - py3{8,9,10,11}-test-instrumentation-flask-{300} - pypy3-test-instrumentation-flask-{213,220} + ; The numbers at the end of the environment names + ; below mean these dependencies are being used: + ; 0: Flask ==2.1.3 Werkzeug <3.0.0 + ; 1: Flask ==2.2.0 Werkzeug <3.0.0 + ; 2: Flask >=3.0.0 Werkzeug >=3.0.0 + py3{8,9,10,11}-test-instrumentation-flask-{0,1} + py3{8,9,10,11}-test-instrumentation-flask-{2} + pypy3-test-instrumentation-flask-{0,1} ; opentelemetry-instrumentation-urllib py3{8,9,10,11}-test-instrumentation-urllib @@ -277,12 +282,6 @@ deps = falcon-1: falcon ==1.4.1 falcon-2: falcon >=2.0.0,<3.0.0 falcon-3: falcon >=3.0.0,<4.0.0 - flask-213: Flask ==2.1.3 - flask-213: Werkzeug <3.0.0 - flask-220: Flask ==2.2.0 - flask-220: Werkzeug <3.0.0 - flask-300: Flask >=3.0.0 - flask-300: Werkzeug >=3.0.0 grpc: pytest-asyncio sqlalchemy-11: sqlalchemy>=1.1,<1.2 sqlalchemy-14: aiosqlite @@ -339,8 +338,8 @@ commands_pre = grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] - falcon-{1,2,3},flask-{213,220,300},django-{1,2,3,4},pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http - wsgi,falcon-{1,2,3},flask-{213,220,300},django-{1,2,3,4},pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] + falcon-{1,2,3},django-{1,2,3,4},pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http + wsgi,falcon-{1,2,3},django-{1,2,3,4},pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] django-{3,4},starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi asyncpg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg[test] @@ -354,7 +353,9 @@ commands_pre = falcon-{1,2,3}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon[test] - flask-{213,220,300}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-flask[test] + flask-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt + flask-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt + flask-2: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt urllib: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-urllib[test] @@ -548,7 +549,7 @@ commands_pre = python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-boto[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-flask[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlalchemy[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-cassandra[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-celery[test] From 5f68e9701bed6a12b90100595839690c04dc8d5d Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 18:54:12 -0600 Subject: [PATCH 12/17] Remove [test] package for django instrumentation (#2311) Fixes #2198 --- .../pyproject.toml | 4 --- .../test-requirements-0.txt | 22 +++++++++++++ .../test-requirements-1.txt | 23 +++++++++++++ .../test-requirements-2.txt | 23 +++++++++++++ .../test-requirements-3.txt | 22 +++++++++++++ tox.ini | 33 ++++++++++++------- 6 files changed, 112 insertions(+), 15 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt create mode 100644 instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt create mode 100644 instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt create mode 100644 instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt diff --git a/instrumentation/opentelemetry-instrumentation-django/pyproject.toml b/instrumentation/opentelemetry-instrumentation-django/pyproject.toml index 50cc227e44..65be04cb69 100644 --- a/instrumentation/opentelemetry-instrumentation-django/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-django/pyproject.toml @@ -38,10 +38,6 @@ asgi = [ instruments = [ "django >= 1.10", ] -test = [ - "opentelemetry-instrumentation-django[instruments]", - "opentelemetry-test-utils == 0.45b0.dev", -] [project.entry-points.opentelemetry_instrumentor] django = "opentelemetry.instrumentation.django:DjangoInstrumentor" diff --git a/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt new file mode 100644 index 0000000000..6dce957000 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt @@ -0,0 +1,22 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +Django==2.2.28 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +pytz==2024.1 +sqlparse==0.4.4 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-django diff --git a/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt new file mode 100644 index 0000000000..116dc015ec --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt @@ -0,0 +1,23 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +Django==3.2.24 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +pytz==2024.1 +sqlparse==0.4.4 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e instrumentation/opentelemetry-instrumentation-asgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-django diff --git a/instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt new file mode 100644 index 0000000000..ac3b40e16b --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt @@ -0,0 +1,23 @@ +asgiref==3.7.2 +attrs==23.2.0 +backports.zoneinfo==0.2.1 +Deprecated==1.2.14 +Django==4.2.10 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +sqlparse==0.4.4 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e instrumentation/opentelemetry-instrumentation-asgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-django diff --git a/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt b/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt new file mode 100644 index 0000000000..3bb32c4c6b --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt @@ -0,0 +1,22 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +Django==4.2.10 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +sqlparse==0.4.4 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e instrumentation/opentelemetry-instrumentation-asgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-django diff --git a/tox.ini b/tox.ini index d61f050571..411f73f2f3 100644 --- a/tox.ini +++ b/tox.ini @@ -52,10 +52,18 @@ envlist = ; Only officially supported Python versions are tested for each Django ; major release. Updated list can be found at: ; https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django + ; The numbers at the end of the environment names + ; below mean these dependencies are being used: + ; 0: django~=2.0 + ; 1: django~=3.0 + ; 2: django>=4.0b1,<5.0 backports.zoneinfo==0.2.1 + ; 3: django>=4.0b1,<5.0 + py3{8,9}-test-instrumentation-django-0 + py3{8,9}-test-instrumentation-django-1 py3{8,9}-test-instrumentation-django-2 - py3{8,9,10,11}-test-instrumentation-django-3 - py3{8,9,10,11}-test-instrumentation-django-4 - pypy3-test-instrumentation-django-{2,3} + py3{10,11}-test-instrumentation-django-1 + py3{10,11}-test-instrumentation-django-3 + pypy3-test-instrumentation-django-{0,1} ; opentelemetry-instrumentation-dbapi py3{8,9,10,11}-test-instrumentation-dbapi @@ -265,9 +273,6 @@ deps = test: pytest-benchmark coverage: pytest coverage: pytest-cov - django-2: django~=2.0 - django-3: django~=3.0 - django-4: django>=4.0b1,<5.0 elasticsearch-2: elasticsearch-dsl>=2.0,<3.0 elasticsearch-2: elasticsearch>=2.0,<3.0 elasticsearch-5: elasticsearch-dsl>=5.0,<6.0 @@ -338,9 +343,9 @@ commands_pre = grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] - falcon-{1,2,3},django-{1,2,3,4},pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http - wsgi,falcon-{1,2,3},django-{1,2,3,4},pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] - django-{3,4},starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi + falcon-{1,2,3},pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http + wsgi,falcon-{1,2,3},pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] + starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi asyncpg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg[test] @@ -367,7 +372,13 @@ commands_pre = dbapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi[test] - django-{1,2,3,4}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-django[test] + py3{8,9}-test-instrumentation-django-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt + py3{8,9}-test-instrumentation-django-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt + py3{8,9}-test-instrumentation-django-2: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt + py3{10,11}-test-instrumentation-django-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt + py3{10,11}-test-instrumentation-django-3: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt + pypy3-test-instrumentation-django-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt + pypy3-test-instrumentation-django-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-fastapi[test] @@ -544,7 +555,7 @@ commands_pre = pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-botocore[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-boto3sqs[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-django[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon[test] From ce2de1f5a933f66b9c72fe293a04dde39a368eb7 Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 19:05:44 -0600 Subject: [PATCH 13/17] Remove [test] package from falcon instrumentation (#2313) Fixes #2200 --- .../pyproject.toml | 4 ---- .../test-requirements-0.txt | 22 +++++++++++++++++ .../test-requirements-1.txt | 20 ++++++++++++++++ .../test-requirements-2.txt | 20 ++++++++++++++++ tox.ini | 24 +++++++++++-------- 5 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt create mode 100644 instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt create mode 100644 instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt diff --git a/instrumentation/opentelemetry-instrumentation-falcon/pyproject.toml b/instrumentation/opentelemetry-instrumentation-falcon/pyproject.toml index 1e4b5e5254..dab9534bf9 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-falcon/pyproject.toml @@ -36,10 +36,6 @@ dependencies = [ instruments = [ "falcon >= 1.4.1, < 3.1.2", ] -test = [ - "opentelemetry-instrumentation-falcon[instruments]", - "opentelemetry-test-utils == 0.45b0.dev", -] [project.entry-points.opentelemetry_instrumentor] falcon = "opentelemetry.instrumentation.falcon:FalconInstrumentor" diff --git a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt new file mode 100644 index 0000000000..31c7f1d7c8 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt @@ -0,0 +1,22 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +falcon==1.4.1 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +python-mimeparse==1.6.0 +six==1.16.0 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-falcon diff --git a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt new file mode 100644 index 0000000000..ad476d7c22 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt @@ -0,0 +1,20 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +falcon==2.0.0 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-falcon diff --git a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt new file mode 100644 index 0000000000..6c5c3e8ac9 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt @@ -0,0 +1,20 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +falcon==3.1.1 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.10.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-falcon diff --git a/tox.ini b/tox.ini index 411f73f2f3..8ba4d6722d 100644 --- a/tox.ini +++ b/tox.ini @@ -82,9 +82,14 @@ envlist = ; opentelemetry-instrumentation-falcon ; py310 does not work with falcon 1 - py3{8,9}-test-instrumentation-falcon-1 - py3{8,9,10,11}-test-instrumentation-falcon-{2,3} - pypy3-test-instrumentation-falcon-{1,2,3} + ; The numbers at the end of the environment names + ; below mean these dependencies are being used: + ; 0: falcon ==1.4.1 + ; 1: falcon >=2.0.0,<3.0.0 + ; 2: falcon >=3.0.0,<4.0.0 + py3{8,9}-test-instrumentation-falcon-0 + py3{8,9,10,11}-test-instrumentation-falcon-{1,2} + pypy3-test-instrumentation-falcon-{0,1,2} ; opentelemetry-instrumentation-fastapi py3{8,9,10,11}-test-instrumentation-fastapi @@ -284,9 +289,6 @@ deps = ; elasticsearch-7: elasticsearch>=7.0,<8.0 ; elasticsearch-8: elasticsearch-dsl>=8.0,<9.0 ; elasticsearch-8: elasticsearch>=8.0,<9.0 - falcon-1: falcon ==1.4.1 - falcon-2: falcon >=2.0.0,<3.0.0 - falcon-3: falcon >=3.0.0,<4.0.0 grpc: pytest-asyncio sqlalchemy-11: sqlalchemy>=1.1,<1.2 sqlalchemy-14: aiosqlite @@ -343,8 +345,8 @@ commands_pre = grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] - falcon-{1,2,3},pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http - wsgi,falcon-{1,2,3},pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] + pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http + wsgi,pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi asyncpg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg[test] @@ -356,7 +358,9 @@ commands_pre = boto3sqs: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-boto3sqs[test] - falcon-{1,2,3}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon[test] + falcon-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt + falcon-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt + falcon-2: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt flask-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt flask-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt @@ -558,7 +562,7 @@ commands_pre = pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-boto[test] pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlalchemy[test] From ba05c2c0c33297c08eb98d87742b68c48b09f10f Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 19:15:50 -0600 Subject: [PATCH 14/17] Remove [test] package from wsgi instrumentation (#2283) Fixes #2227 --- .../pyproject.toml | 3 --- .../test-requirements.txt | 18 ++++++++++++++++++ tox.ini | 8 +++++--- 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/pyproject.toml b/instrumentation/opentelemetry-instrumentation-wsgi/pyproject.toml index bb1b6ef286..69b0e7ff41 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-wsgi/pyproject.toml @@ -32,9 +32,6 @@ dependencies = [ [project.optional-dependencies] instruments = [] -test = [ - "opentelemetry-test-utils == 0.45b0.dev", -] [project.urls] Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-wsgi" diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt new file mode 100644 index 0000000000..a4910352ed --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt @@ -0,0 +1,18 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +typing_extensions==4.9.0 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-wsgi diff --git a/tox.ini b/tox.ini index 8ba4d6722d..e1d78919bc 100644 --- a/tox.ini +++ b/tox.ini @@ -345,10 +345,12 @@ commands_pre = grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] - pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http - wsgi,pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] + pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2}: pip install {toxinidir}/util/opentelemetry-util-http + pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi + wsgi: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt + asyncpg: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asyncpg[test] aws-lambda: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aws-lambda[test] @@ -554,7 +556,7 @@ commands_pre = python -m pip install {env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils python -m pip install -e {toxinidir}/util/opentelemetry-util-http[test] python -m pip install -e {toxinidir}/opentelemetry-instrumentation[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi[test] pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-botocore[test] From e56cdc8feca09d611ac837e7268d30b676025a4a Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 19:29:18 -0600 Subject: [PATCH 15/17] Remove [test] package from pyramid instrumentation (#2273) Fixes #2214 --- .../pyproject.toml | 5 ---- .../test-requirements.txt | 30 +++++++++++++++++++ tox.ini | 7 ++--- 3 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/pyproject.toml b/instrumentation/opentelemetry-instrumentation-pyramid/pyproject.toml index 1face37ccc..4f6577d4a8 100644 --- a/instrumentation/opentelemetry-instrumentation-pyramid/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-pyramid/pyproject.toml @@ -36,11 +36,6 @@ dependencies = [ instruments = [ "pyramid >= 1.7", ] -test = [ - "opentelemetry-instrumentation-pyramid[instruments]", - "opentelemetry-test-utils == 0.45b0.dev", - "werkzeug == 0.16.1", -] [project.entry-points.opentelemetry_instrumentor] pyramid = "opentelemetry.instrumentation.pyramid:PyramidInstrumentor" diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt new file mode 100644 index 0000000000..1362e7166e --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt @@ -0,0 +1,30 @@ +asgiref==3.7.2 +attrs==23.2.0 +Deprecated==1.2.14 +hupper==1.12.1 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +PasteDeploy==3.1.0 +plaster==1.1.2 +plaster-pastedeploy==1.0.1 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pyramid==2.0.2 +pytest==7.1.3 +pytest-benchmark==4.0.0 +tomli==2.0.1 +translationstring==1.4 +typing_extensions==4.9.0 +venusian==3.1.0 +WebOb==1.8.7 +Werkzeug==0.16.1 +wrapt==1.16.0 +zipp==3.17.0 +zope.deprecation==5.0 +zope.interface==6.2 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-wsgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-pyramid diff --git a/tox.ini b/tox.ini index e1d78919bc..ac4123f4ce 100644 --- a/tox.ini +++ b/tox.ini @@ -345,8 +345,7 @@ commands_pre = grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] - pyramid,tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2}: pip install {toxinidir}/util/opentelemetry-util-http - pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi + tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2}: pip install {toxinidir}/util/opentelemetry-util-http starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi wsgi: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt @@ -402,7 +401,7 @@ commands_pre = pymysql: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi {toxinidir}/instrumentation/opentelemetry-instrumentation-pymysql[test] - pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-pyramid[test] + pyramid: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt sqlite3: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-dbapi {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlite3[test] @@ -587,7 +586,7 @@ commands_pre = python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-server[test] pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlite3[test] - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-pyramid[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-requests[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-urllib[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-urllib3[test] From e923938646341c2ec54d7ba55cb486b1a2b6e7b7 Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Thu, 14 Mar 2024 19:53:17 -0600 Subject: [PATCH 16/17] Remove [test] package from starlette instrumentation (#2278) Fixes #2221 --- .../pyproject.toml | 6 ---- .../test-requirements.txt | 31 +++++++++++++++++++ tox.ini | 8 ++--- 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt diff --git a/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml b/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml index 8b2f2a7014..a73d5b0455 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml @@ -35,12 +35,6 @@ dependencies = [ instruments = [ "starlette ~= 0.13.0", ] -test = [ - "opentelemetry-instrumentation-starlette[instruments]", - "opentelemetry-test-utils == 0.45b0.dev", - "requests ~= 2.23", # needed for testclient - "httpx ~= 0.22", # needed for testclient -] [project.entry-points.opentelemetry_instrumentor] starlette = "opentelemetry.instrumentation.starlette:StarletteInstrumentor" diff --git a/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt new file mode 100644 index 0000000000..1cd21039a7 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt @@ -0,0 +1,31 @@ +anyio==4.3.0 +asgiref==3.7.2 +attrs==23.2.0 +certifi==2024.2.2 +charset-normalizer==3.3.2 +Deprecated==1.2.14 +exceptiongroup==1.2.0 +h11==0.14.0 +httpcore==1.0.4 +httpx==0.27.0 +idna==3.6 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.4.0 +py==1.11.0 +py-cpuinfo==9.0.0 +pytest==7.1.3 +pytest-benchmark==4.0.0 +requests==2.31.0 +sniffio==1.3.0 +starlette==0.13.8 +tomli==2.0.1 +typing_extensions==4.9.0 +urllib3==2.2.1 +wrapt==1.16.0 +zipp==3.17.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-asgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-starlette diff --git a/tox.ini b/tox.ini index ac4123f4ce..6c0f00b7c2 100644 --- a/tox.ini +++ b/tox.ini @@ -345,8 +345,8 @@ commands_pre = grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] - tornado,starlette,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2}: pip install {toxinidir}/util/opentelemetry-util-http - starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi + tornado,fastapi,aiohttp,httpx-{18,21},requests,urllib,urllib3v-{1,2}: pip install {toxinidir}/util/opentelemetry-util-http + fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi wsgi: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt @@ -411,7 +411,7 @@ commands_pre = requests: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-requests[test] - starlette: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette[test] + starlette: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt system-metrics: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-system-metrics[test] @@ -561,7 +561,7 @@ commands_pre = python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-botocore[test] python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-boto3sqs[test] pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt - python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette[test] + pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test] pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-boto[test] From fd6b8f1647e18b9c2be4e45d46ed49b50902923f Mon Sep 17 00:00:00 2001 From: Mario de Frutos Dieguez Date: Fri, 15 Mar 2024 13:07:40 +0100 Subject: [PATCH 17/17] Fix response hook (#2038) Response hook receives a third parameter, Response, and that should be reflected in the _ResponseHook type Co-authored-by: Leighton Chen Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com> --- .../src/opentelemetry/instrumentation/requests/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py index 4c198596a2..d0150d57b7 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py @@ -105,7 +105,7 @@ _excluded_urls_from_env = get_excluded_urls("REQUESTS") _RequestHookT = Optional[Callable[[Span, PreparedRequest], None]] -_ResponseHookT = Optional[Callable[[Span, PreparedRequest], None]] +_ResponseHookT = Optional[Callable[[Span, PreparedRequest, Response], None]] # pylint: disable=unused-argument