Skip to content

Commit

Permalink
psycopg2-binary support (#3186)
Browse files Browse the repository at this point in the history
* psycopg2-binary support

* changelog

* Update CHANGELOG.md

* Update pyproject.toml

* fix

* lint

* added test config

* Update bootstrap_gen.py

* update tox

* Update tox.ini

* regenerate workflows

* workflows

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
  • Loading branch information
3 people authored Jan 21, 2025
1 parent 37f85bf commit 3f50c08
Show file tree
Hide file tree
Showing 11 changed files with 296 additions and 111 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/core_contrib_test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,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-uv

- name: Run tests
run: tox -e py38-test-instrumentation-psycopg2-binary -- -ra

py38-test-instrumentation-psycopg:
name: instrumentation-psycopg
runs-on: ubuntu-latest
Expand Down
216 changes: 108 additions & 108 deletions .github/workflows/test_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,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
Expand Down Expand Up @@ -4407,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
108 changes: 108 additions & 0 deletions .github/workflows/test_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,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))
- `opentelemetry-opentelemetry-botocore` Add basic support for GenAI attributes for AWS Bedrock Converse API
([#3161](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3161))

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading

0 comments on commit 3f50c08

Please sign in to comment.