From 462effe91ce6f7a1e7f46e833b5f63a9c4d792d6 Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Tue, 14 Jan 2025 11:17:38 -0500 Subject: [PATCH 01/12] psycopg2-binary support --- instrumentation/README.md | 2 +- .../src/opentelemetry/instrumentation/psycopg2/package.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/instrumentation/README.md b/instrumentation/README.md index 75341dad9a..a229951b4b 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -32,7 +32,7 @@ | [opentelemetry-instrumentation-mysqlclient](./opentelemetry-instrumentation-mysqlclient) | mysqlclient < 3 | No | experimental | [opentelemetry-instrumentation-pika](./opentelemetry-instrumentation-pika) | pika >= 0.12.0 | No | experimental | [opentelemetry-instrumentation-psycopg](./opentelemetry-instrumentation-psycopg) | psycopg >= 3.1.0 | No | experimental -| [opentelemetry-instrumentation-psycopg2](./opentelemetry-instrumentation-psycopg2) | psycopg2 >= 2.7.3.1 | No | experimental +| [opentelemetry-instrumentation-psycopg2](./opentelemetry-instrumentation-psycopg2) | psycopg2 >= 2.7.3.1,psycopg2-binary >= 2.7.3.1 | No | experimental | [opentelemetry-instrumentation-pymemcache](./opentelemetry-instrumentation-pymemcache) | pymemcache >= 1.3.5, < 5 | No | experimental | [opentelemetry-instrumentation-pymongo](./opentelemetry-instrumentation-pymongo) | pymongo >= 3.1, < 5.0 | No | experimental | [opentelemetry-instrumentation-pymysql](./opentelemetry-instrumentation-pymysql) | PyMySQL < 2 | No | experimental diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py index 9757a8df79..6845beffc7 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py @@ -13,4 +13,4 @@ # limitations under the License. -_instruments = ("psycopg2 >= 2.7.3.1",) +_instruments = ("psycopg2 >= 2.7.3.1", "psycopg2-binary >= 2.7.3.1",) From 401ccaea994ced1944566d574634062f0a0ef60e Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Tue, 14 Jan 2025 11:18:36 -0500 Subject: [PATCH 02/12] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea1a44b574..03383708c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > Use [this search for a list of all CHANGELOG.md files in this repo](https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-python-contrib+path%3A**%2FCHANGELOG.md&type=code). ## Unreleased +- `opentelemetry-instrumentation-psycopg2` Add support for psycopg2-binary + ([#3186](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3186)) ### Added From 963b42f6fba6df9f7c078afc111025e0b087efec Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Tue, 14 Jan 2025 11:33:53 -0500 Subject: [PATCH 03/12] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c18deff54..1fcdcb5407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > Use [this search for a list of all CHANGELOG.md files in this repo](https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-python-contrib+path%3A**%2FCHANGELOG.md&type=code). ## Unreleased -- `opentelemetry-instrumentation-psycopg2` Add support for psycopg2-binary - ([#3186](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3186)) ### Added @@ -41,6 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3129](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3129)) - `opentelemetry-util-http` Add `py.typed` file to enable PEP 561 ([#3127](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3127)) +- `opentelemetry-instrumentation-psycopg2` Add support for psycopg2-binary + ([#3186](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3186)) ### Fixed From 4f5075687ccaf2335dea49d4773c5fd211cd9ed9 Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Tue, 14 Jan 2025 12:09:05 -0500 Subject: [PATCH 04/12] Update pyproject.toml --- .../opentelemetry-instrumentation-psycopg2/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/pyproject.toml b/instrumentation/opentelemetry-instrumentation-psycopg2/pyproject.toml index c8ce3e8dfa..54f5bf6f3e 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ [project.optional-dependencies] instruments = [ "psycopg2 >= 2.7.3.1", + "psycopg2-binary >= 2.7.3.1", ] [project.entry-points.opentelemetry_instrumentor] From 0220f73c80bd2cc5e5a6417afb3595a6e5db7d04 Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Tue, 14 Jan 2025 12:33:59 -0500 Subject: [PATCH 05/12] fix --- .../instrumentation/psycopg2/__init__.py | 18 +++++++++++++++++- .../instrumentation/psycopg2/package.py | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py index f03ad1de0d..459292f03b 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py @@ -140,6 +140,7 @@ import logging import typing from typing import Collection +from importlib.metadata import PackageNotFoundError, distribution import psycopg2 from psycopg2.extensions import ( @@ -149,7 +150,7 @@ from opentelemetry.instrumentation import dbapi from opentelemetry.instrumentation.instrumentor import BaseInstrumentor -from opentelemetry.instrumentation.psycopg2.package import _instruments +from opentelemetry.instrumentation.psycopg2.package import _instruments, _instruments_psycopg2, _instruments_psycopg2_binary from opentelemetry.instrumentation.psycopg2.version import __version__ _logger = logging.getLogger(__name__) @@ -167,6 +168,21 @@ class Psycopg2Instrumentor(BaseInstrumentor): _DATABASE_SYSTEM = "postgresql" def instrumentation_dependencies(self) -> Collection[str]: + # Determine which package of psycopg2 is installed + # Right now there are two packages, psycopg2 and psycopg2-binary + # The latter is a binary wheel package that does not require a compiler + try: + distribution("psycopg2") + return (_instruments_psycopg2,) + except PackageNotFoundError: + pass + + try: + distribution("psycopg2-binary") + return (_instruments_psycopg2_binary,) + except PackageNotFoundError: + pass + return _instruments def _instrument(self, **kwargs): diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py index 6845beffc7..4df95f7e30 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py @@ -13,4 +13,7 @@ # limitations under the License. -_instruments = ("psycopg2 >= 2.7.3.1", "psycopg2-binary >= 2.7.3.1",) +_instruments_psycopg2 = "psycopg2 >= 2.7.3.1" +_instruments_psycopg2_binary = "psycopg2-binary >= 2.7.3.1" + +_instruments = (_instruments_psycopg2, _instruments_psycopg2_binary,) From 196eb1d3a7534873c7b3a928d8e13590c0df8c34 Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Tue, 14 Jan 2025 12:36:00 -0500 Subject: [PATCH 06/12] lint --- .../opentelemetry/instrumentation/psycopg2/__init__.py | 8 ++++++-- .../src/opentelemetry/instrumentation/psycopg2/package.py | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py index 459292f03b..022c59f031 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/__init__.py @@ -139,8 +139,8 @@ import logging import typing -from typing import Collection from importlib.metadata import PackageNotFoundError, distribution +from typing import Collection import psycopg2 from psycopg2.extensions import ( @@ -150,7 +150,11 @@ from opentelemetry.instrumentation import dbapi from opentelemetry.instrumentation.instrumentor import BaseInstrumentor -from opentelemetry.instrumentation.psycopg2.package import _instruments, _instruments_psycopg2, _instruments_psycopg2_binary +from opentelemetry.instrumentation.psycopg2.package import ( + _instruments, + _instruments_psycopg2, + _instruments_psycopg2_binary, +) from opentelemetry.instrumentation.psycopg2.version import __version__ _logger = logging.getLogger(__name__) diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py index 4df95f7e30..b1bf92901a 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/package.py @@ -16,4 +16,7 @@ _instruments_psycopg2 = "psycopg2 >= 2.7.3.1" _instruments_psycopg2_binary = "psycopg2-binary >= 2.7.3.1" -_instruments = (_instruments_psycopg2, _instruments_psycopg2_binary,) +_instruments = ( + _instruments_psycopg2, + _instruments_psycopg2_binary, +) From a9968dab21fdf3c8ef8bff13cffb1507288c538e Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Thu, 16 Jan 2025 08:44:24 -0500 Subject: [PATCH 07/12] added test config --- .../test-requirements-binary.txt | 15 +++++++++++++++ tox.ini | 1 + 2 files changed, 16 insertions(+) create mode 100644 instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements-binary.txt diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements-binary.txt b/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements-binary.txt new file mode 100644 index 0000000000..80fa036b99 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements-binary.txt @@ -0,0 +1,15 @@ +asgiref==3.8.1 +Deprecated==1.2.14 +iniconfig==2.0.0 +packaging==24.0 +pluggy==1.5.0 +psycopg2-binary==2.9.10 +py-cpuinfo==9.0.0 +pytest==7.4.4 +tomli==2.0.1 +typing_extensions==4.12.2 +wrapt==1.16.0 +zipp==3.19.2 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-dbapi +-e instrumentation/opentelemetry-instrumentation-psycopg2 diff --git a/tox.ini b/tox.ini index feeda77702..efcde4df57 100644 --- a/tox.ini +++ b/tox.ini @@ -564,6 +564,7 @@ deps = psycopg2: {[testenv]test_deps} psycopg2: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements.txt + psycopg2-binary: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements-binary.txt pymysql: {[testenv]test_deps} pymysql: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-pymysql/test-requirements.txt From f853a1aa0281b81bfc3be53863c07d5188afbeae Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Thu, 16 Jan 2025 13:40:19 -0500 Subject: [PATCH 08/12] Update bootstrap_gen.py --- .../src/opentelemetry/instrumentation/bootstrap_gen.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index a55f0ccd8e..7753c4de77 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -144,6 +144,10 @@ "library": "psycopg2 >= 2.7.3.1", "instrumentation": "opentelemetry-instrumentation-psycopg2==0.51b0.dev", }, + { + "library": "psycopg2-binary >= 2.7.3.1", + "instrumentation": "opentelemetry-instrumentation-psycopg2==0.51b0.dev", + }, { "library": "pymemcache >= 1.3.5, < 5", "instrumentation": "opentelemetry-instrumentation-pymemcache==0.51b0.dev", From cd66dc4cdb45754be770725781cf4ce1571bf554 Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Thu, 16 Jan 2025 19:04:11 -0500 Subject: [PATCH 09/12] update tox --- .github/workflows/core_contrib_test_0.yml | 22 +++ .github/workflows/test_1.yml | 216 +++++++++++----------- .github/workflows/test_2.yml | 108 +++++++++++ tox.ini | 4 + 4 files changed, 242 insertions(+), 108 deletions(-) diff --git a/.github/workflows/core_contrib_test_0.yml b/.github/workflows/core_contrib_test_0.yml index 6c0616e0a6..e9ff519db4 100644 --- a/.github/workflows/core_contrib_test_0.yml +++ b/.github/workflows/core_contrib_test_0.yml @@ -1053,6 +1053,28 @@ jobs: - name: Run tests run: tox -e py38-test-instrumentation-psycopg2 -- -ra + py38-test-instrumentation-psycopg2-binary: + name: instrumentation-psycopg2-binary + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-psycopg2-binary -- -ra + py38-test-instrumentation-psycopg: name: instrumentation-psycopg runs-on: ubuntu-latest diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index b26bb48e33..889e888578 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -1114,6 +1114,114 @@ jobs: - name: Run tests run: tox -e py313-test-instrumentation-psycopg2 -- -ra + py38-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-psycopg2-binary -- -ra + + py39-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py39-test-instrumentation-psycopg2-binary -- -ra + + py310-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py310-test-instrumentation-psycopg2-binary -- -ra + + py311-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.11 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py311-test-instrumentation-psycopg2-binary -- -ra + + py312-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.12 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py312-test-instrumentation-psycopg2-binary -- -ra + + py313-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.13 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py313-test-instrumentation-psycopg2-binary -- -ra + py38-test-instrumentation-psycopg_ubuntu-latest: name: instrumentation-psycopg 3.8 Ubuntu runs-on: ubuntu-latest @@ -4407,111 +4515,3 @@ jobs: - name: Run tests run: tox -e pypy3-test-util-http -- -ra - - py38-test-propagator-aws-xray-0_ubuntu-latest: - name: propagator-aws-xray-0 3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py38-test-propagator-aws-xray-0 -- -ra - - py38-test-propagator-aws-xray-1_ubuntu-latest: - name: propagator-aws-xray-1 3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py38-test-propagator-aws-xray-1 -- -ra - - py39-test-propagator-aws-xray-0_ubuntu-latest: - name: propagator-aws-xray-0 3.9 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py39-test-propagator-aws-xray-0 -- -ra - - py39-test-propagator-aws-xray-1_ubuntu-latest: - name: propagator-aws-xray-1 3.9 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py39-test-propagator-aws-xray-1 -- -ra - - py310-test-propagator-aws-xray-0_ubuntu-latest: - name: propagator-aws-xray-0 3.10 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py310-test-propagator-aws-xray-0 -- -ra - - py310-test-propagator-aws-xray-1_ubuntu-latest: - name: propagator-aws-xray-1 3.10 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox - - - name: Run tests - run: tox -e py310-test-propagator-aws-xray-1 -- -ra diff --git a/.github/workflows/test_2.yml b/.github/workflows/test_2.yml index ceac5ac9ed..30390fe825 100644 --- a/.github/workflows/test_2.yml +++ b/.github/workflows/test_2.yml @@ -16,6 +16,114 @@ env: jobs: + py38-test-propagator-aws-xray-0_ubuntu-latest: + name: propagator-aws-xray-0 3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-propagator-aws-xray-0 -- -ra + + py38-test-propagator-aws-xray-1_ubuntu-latest: + name: propagator-aws-xray-1 3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-propagator-aws-xray-1 -- -ra + + py39-test-propagator-aws-xray-0_ubuntu-latest: + name: propagator-aws-xray-0 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py39-test-propagator-aws-xray-0 -- -ra + + py39-test-propagator-aws-xray-1_ubuntu-latest: + name: propagator-aws-xray-1 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py39-test-propagator-aws-xray-1 -- -ra + + py310-test-propagator-aws-xray-0_ubuntu-latest: + name: propagator-aws-xray-0 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py310-test-propagator-aws-xray-0 -- -ra + + py310-test-propagator-aws-xray-1_ubuntu-latest: + name: propagator-aws-xray-1 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py310-test-propagator-aws-xray-1 -- -ra + py311-test-propagator-aws-xray-0_ubuntu-latest: name: propagator-aws-xray-0 3.11 Ubuntu runs-on: ubuntu-latest diff --git a/tox.ini b/tox.ini index efcde4df57..94c3988295 100644 --- a/tox.ini +++ b/tox.ini @@ -210,6 +210,7 @@ envlist = ; opentelemetry-instrumentation-psycopg2 py3{8,9,10,11,12,13}-test-instrumentation-psycopg2 + py3{8,9,10,11,12,13}-test-instrumentation-psycopg2-binary ; ext-psycopg2 intentionally excluded from pypy3 lint-instrumentation-psycopg2 @@ -805,6 +806,9 @@ commands = test-instrumentation-psycopg2: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/tests {posargs} lint-instrumentation-psycopg2: sh -c "cd instrumentation && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-psycopg2" + ; Test only for psycopg2-binary instrumentation as the only difference between psycopg2 and psycopg2-binary is the install method + test-instrumentation-psycopg2-binary: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/tests {posargs} + test-instrumentation-pymemcache: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-pymemcache/tests {posargs} lint-instrumentation-pymemcache: sh -c "cd instrumentation && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-pymemcache" From 16ba9ab893b3a4ff1661c5f10b230d128b74ce16 Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Thu, 16 Jan 2025 19:10:27 -0500 Subject: [PATCH 10/12] Update tox.ini --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 94c3988295..823052e396 100644 --- a/tox.ini +++ b/tox.ini @@ -565,6 +565,8 @@ deps = psycopg2: {[testenv]test_deps} psycopg2: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements.txt + + psycopg2-binary: {[testenv]test_deps} psycopg2-binary: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements-binary.txt pymysql: {[testenv]test_deps} From 564547e15c556bc75700a6529a38ab5ffe5a199d Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Fri, 17 Jan 2025 12:11:20 -0500 Subject: [PATCH 11/12] regenerate workflows --- .github/workflows/core_contrib_test_0.yml | 2 +- .github/workflows/test_1.yml | 216 +++++++++++----------- .github/workflows/test_2.yml | 12 +- 3 files changed, 115 insertions(+), 115 deletions(-) diff --git a/.github/workflows/core_contrib_test_0.yml b/.github/workflows/core_contrib_test_0.yml index 8e432e056c..33b4126977 100644 --- a/.github/workflows/core_contrib_test_0.yml +++ b/.github/workflows/core_contrib_test_0.yml @@ -1070,7 +1070,7 @@ jobs: architecture: "x64" - name: Install tox - run: pip install tox + run: pip install tox-uv - name: Run tests run: tox -e py38-test-instrumentation-psycopg2-binary -- -ra diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index 7cd1b5ed61..675039a2ce 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -1114,6 +1114,114 @@ jobs: - name: Run tests run: tox -e py313-test-instrumentation-psycopg2 -- -ra + py38-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py38-test-instrumentation-psycopg2-binary -- -ra + + py39-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-instrumentation-psycopg2-binary -- -ra + + py310-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-instrumentation-psycopg2-binary -- -ra + + py311-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.11 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-instrumentation-psycopg2-binary -- -ra + + py312-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.12 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-instrumentation-psycopg2-binary -- -ra + + py313-test-instrumentation-psycopg2-binary_ubuntu-latest: + name: instrumentation-psycopg2-binary 3.13 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-instrumentation-psycopg2-binary -- -ra + py38-test-instrumentation-psycopg_ubuntu-latest: name: instrumentation-psycopg 3.8 Ubuntu runs-on: ubuntu-latest @@ -4407,111 +4515,3 @@ jobs: - name: Run tests run: tox -e pypy3-test-util-http -- -ra - - py38-test-propagator-aws-xray-0_ubuntu-latest: - name: propagator-aws-xray-0 3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py38-test-propagator-aws-xray-0 -- -ra - - py38-test-propagator-aws-xray-1_ubuntu-latest: - name: propagator-aws-xray-1 3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py38-test-propagator-aws-xray-1 -- -ra - - py39-test-propagator-aws-xray-0_ubuntu-latest: - name: propagator-aws-xray-0 3.9 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-propagator-aws-xray-0 -- -ra - - py39-test-propagator-aws-xray-1_ubuntu-latest: - name: propagator-aws-xray-1 3.9 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-propagator-aws-xray-1 -- -ra - - py310-test-propagator-aws-xray-0_ubuntu-latest: - name: propagator-aws-xray-0 3.10 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-propagator-aws-xray-0 -- -ra - - py310-test-propagator-aws-xray-1_ubuntu-latest: - name: propagator-aws-xray-1 3.10 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-propagator-aws-xray-1 -- -ra diff --git a/.github/workflows/test_2.yml b/.github/workflows/test_2.yml index 9fc501927a..bc52c4eba4 100644 --- a/.github/workflows/test_2.yml +++ b/.github/workflows/test_2.yml @@ -29,7 +29,7 @@ jobs: python-version: "3.8" - name: Install tox - run: pip install tox + run: pip install tox-uv - name: Run tests run: tox -e py38-test-propagator-aws-xray-0 -- -ra @@ -47,7 +47,7 @@ jobs: python-version: "3.8" - name: Install tox - run: pip install tox + run: pip install tox-uv - name: Run tests run: tox -e py38-test-propagator-aws-xray-1 -- -ra @@ -65,7 +65,7 @@ jobs: python-version: "3.9" - name: Install tox - run: pip install tox + run: pip install tox-uv - name: Run tests run: tox -e py39-test-propagator-aws-xray-0 -- -ra @@ -83,7 +83,7 @@ jobs: python-version: "3.9" - name: Install tox - run: pip install tox + run: pip install tox-uv - name: Run tests run: tox -e py39-test-propagator-aws-xray-1 -- -ra @@ -101,7 +101,7 @@ jobs: python-version: "3.10" - name: Install tox - run: pip install tox + run: pip install tox-uv - name: Run tests run: tox -e py310-test-propagator-aws-xray-0 -- -ra @@ -119,7 +119,7 @@ jobs: python-version: "3.10" - name: Install tox - run: pip install tox + run: pip install tox-uv - name: Run tests run: tox -e py310-test-propagator-aws-xray-1 -- -ra From dc168e99dcb2e24510ab12f0bbd200766028e24c Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Tue, 21 Jan 2025 08:44:22 -0500 Subject: [PATCH 12/12] workflows --- .github/workflows/test_1.yml | 108 ----------------------------------- .github/workflows/test_2.yml | 108 +++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 108 deletions(-) diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index 7e408cd0cd..b27fe28466 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -4515,111 +4515,3 @@ jobs: - name: Run tests run: tox -e py38-test-util-http -- -ra - - py39-test-util-http_ubuntu-latest: - name: util-http 3.9 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-util-http -- -ra - - py310-test-util-http_ubuntu-latest: - name: util-http 3.10 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-util-http -- -ra - - py311-test-util-http_ubuntu-latest: - name: util-http 3.11 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py311-test-util-http -- -ra - - py312-test-util-http_ubuntu-latest: - name: util-http 3.12 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py312-test-util-http -- -ra - - py313-test-util-http_ubuntu-latest: - name: util-http 3.13 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.13 - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py313-test-util-http -- -ra - - pypy3-test-util-http_ubuntu-latest: - name: util-http pypy-3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python pypy-3.8 - uses: actions/setup-python@v5 - with: - python-version: "pypy-3.8" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e pypy3-test-util-http -- -ra diff --git a/.github/workflows/test_2.yml b/.github/workflows/test_2.yml index bc52c4eba4..d9b622c5c3 100644 --- a/.github/workflows/test_2.yml +++ b/.github/workflows/test_2.yml @@ -16,6 +16,114 @@ env: jobs: + py39-test-util-http_ubuntu-latest: + name: util-http 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-util-http -- -ra + + py310-test-util-http_ubuntu-latest: + name: util-http 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-util-http -- -ra + + py311-test-util-http_ubuntu-latest: + name: util-http 3.11 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-util-http -- -ra + + py312-test-util-http_ubuntu-latest: + name: util-http 3.12 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-util-http -- -ra + + py313-test-util-http_ubuntu-latest: + name: util-http 3.13 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-util-http -- -ra + + pypy3-test-util-http_ubuntu-latest: + name: util-http pypy-3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.8 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.8" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-util-http -- -ra + py38-test-propagator-aws-xray-0_ubuntu-latest: name: propagator-aws-xray-0 3.8 Ubuntu runs-on: ubuntu-latest