mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 12:43:39 +08:00
psycopg2-binary support (#3186)
* 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>
This commit is contained in:
22
.github/workflows/core_contrib_test_0.yml
vendored
22
.github/workflows/core_contrib_test_0.yml
vendored
@ -1075,6 +1075,28 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: tox -e py38-test-instrumentation-psycopg2 -- -ra
|
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:
|
py38-test-instrumentation-psycopg:
|
||||||
name: instrumentation-psycopg
|
name: instrumentation-psycopg
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
216
.github/workflows/test_1.yml
vendored
216
.github/workflows/test_1.yml
vendored
@ -1222,6 +1222,114 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: tox -e py313-test-instrumentation-psycopg2 -- -ra
|
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:
|
py38-test-instrumentation-psycopg_ubuntu-latest:
|
||||||
name: instrumentation-psycopg 3.8 Ubuntu
|
name: instrumentation-psycopg 3.8 Ubuntu
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -4407,111 +4515,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: tox -e py38-test-util-http -- -ra
|
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
.github/workflows/test_2.yml
vendored
108
.github/workflows/test_2.yml
vendored
@ -16,6 +16,114 @@ env:
|
|||||||
|
|
||||||
jobs:
|
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:
|
py38-test-propagator-aws-xray-0_ubuntu-latest:
|
||||||
name: propagator-aws-xray-0 3.8 Ubuntu
|
name: propagator-aws-xray-0 3.8 Ubuntu
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -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))
|
([#3129](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3129))
|
||||||
- `opentelemetry-util-http` Add `py.typed` file to enable PEP 561
|
- `opentelemetry-util-http` Add `py.typed` file to enable PEP 561
|
||||||
([#3127](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3127))
|
([#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
|
- `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))
|
([#3161](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3161))
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
| [opentelemetry-instrumentation-mysqlclient](./opentelemetry-instrumentation-mysqlclient) | mysqlclient < 3 | No | experimental
|
| [opentelemetry-instrumentation-mysqlclient](./opentelemetry-instrumentation-mysqlclient) | mysqlclient < 3 | No | experimental
|
||||||
| [opentelemetry-instrumentation-pika](./opentelemetry-instrumentation-pika) | pika >= 0.12.0 | 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-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-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-pymongo](./opentelemetry-instrumentation-pymongo) | pymongo >= 3.1, < 5.0 | No | experimental
|
||||||
| [opentelemetry-instrumentation-pymysql](./opentelemetry-instrumentation-pymysql) | PyMySQL < 2 | No | experimental
|
| [opentelemetry-instrumentation-pymysql](./opentelemetry-instrumentation-pymysql) | PyMySQL < 2 | No | experimental
|
||||||
|
@ -34,6 +34,7 @@ dependencies = [
|
|||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
instruments = [
|
instruments = [
|
||||||
"psycopg2 >= 2.7.3.1",
|
"psycopg2 >= 2.7.3.1",
|
||||||
|
"psycopg2-binary >= 2.7.3.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.entry-points.opentelemetry_instrumentor]
|
[project.entry-points.opentelemetry_instrumentor]
|
||||||
|
@ -139,6 +139,7 @@ API
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import typing
|
import typing
|
||||||
|
from importlib.metadata import PackageNotFoundError, distribution
|
||||||
from typing import Collection
|
from typing import Collection
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
@ -149,7 +150,11 @@ from psycopg2.sql import Composed # pylint: disable=no-name-in-module
|
|||||||
|
|
||||||
from opentelemetry.instrumentation import dbapi
|
from opentelemetry.instrumentation import dbapi
|
||||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
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__
|
from opentelemetry.instrumentation.psycopg2.version import __version__
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
@ -167,6 +172,21 @@ class Psycopg2Instrumentor(BaseInstrumentor):
|
|||||||
_DATABASE_SYSTEM = "postgresql"
|
_DATABASE_SYSTEM = "postgresql"
|
||||||
|
|
||||||
def instrumentation_dependencies(self) -> Collection[str]:
|
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
|
return _instruments
|
||||||
|
|
||||||
def _instrument(self, **kwargs):
|
def _instrument(self, **kwargs):
|
||||||
|
@ -13,4 +13,10 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
_instruments = ("psycopg2 >= 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,
|
||||||
|
)
|
||||||
|
@ -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
|
@ -144,6 +144,10 @@ libraries = [
|
|||||||
"library": "psycopg2 >= 2.7.3.1",
|
"library": "psycopg2 >= 2.7.3.1",
|
||||||
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.51b0.dev",
|
"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",
|
"library": "pymemcache >= 1.3.5, < 5",
|
||||||
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.51b0.dev",
|
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.51b0.dev",
|
||||||
|
7
tox.ini
7
tox.ini
@ -212,6 +212,7 @@ envlist =
|
|||||||
|
|
||||||
; opentelemetry-instrumentation-psycopg2
|
; opentelemetry-instrumentation-psycopg2
|
||||||
py3{8,9,10,11,12,13}-test-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
|
; ext-psycopg2 intentionally excluded from pypy3
|
||||||
lint-instrumentation-psycopg2
|
lint-instrumentation-psycopg2
|
||||||
|
|
||||||
@ -574,6 +575,9 @@ deps =
|
|||||||
psycopg2: {[testenv]test_deps}
|
psycopg2: {[testenv]test_deps}
|
||||||
psycopg2: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements.txt
|
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}
|
pymysql: {[testenv]test_deps}
|
||||||
pymysql: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-pymysql/test-requirements.txt
|
pymysql: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-pymysql/test-requirements.txt
|
||||||
|
|
||||||
@ -813,6 +817,9 @@ commands =
|
|||||||
test-instrumentation-psycopg2: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/tests {posargs}
|
test-instrumentation-psycopg2: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-psycopg2/tests {posargs}
|
||||||
lint-instrumentation-psycopg2: sh -c "cd instrumentation && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-psycopg2"
|
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}
|
test-instrumentation-pymemcache: pytest {toxinidir}/instrumentation/opentelemetry-instrumentation-pymemcache/tests {posargs}
|
||||||
lint-instrumentation-pymemcache: sh -c "cd instrumentation && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-pymemcache"
|
lint-instrumentation-pymemcache: sh -c "cd instrumentation && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-pymemcache"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user