* Add support for wrapt 2.x - Update wrapt version constraint from '>=1.0.0, <2.0.0' to '>=1.0.0' in all affected packages - Replace ObjectProxy with BaseObjectProxy where iteration support is not needed - Add fallback import for wrapt 1.x compatibility (ObjectProxy as BaseObjectProxy) - Keep ObjectProxy usage in classes that implement __iter__ (botocore, aiopg) - Update CHANGELOG.md This change maintains backward compatibility with wrapt 1.x while enabling support for wrapt 2.x. BaseObjectProxy is the new base class in wrapt 2.x, while ObjectProxy is now a subclass that adds __iter__() support. Fixes #3903 Related to #3930 and #4082 * Restructure wrapt test requirements - Remove wrapt from base test-requirements.txt (installed via pyproject.toml) - Remove Deprecated from base test-requirements.txt (version conflicts with wrapt 2.x) - Create test-requirements-wrapt1.txt with wrapt<2.0.0 and Deprecated==1.2.14 - Create test-requirements-wrapt2.txt with wrapt>=2.0.0 and Deprecated>=1.2.18 - Update tox.ini to use requirements files instead of factor-based deps - Add Deprecated to lint environment deps This follows the pattern used by other packages (botocore, httpx) and resolves dependency conflicts where Deprecated 1.2.14 requires wrapt<2. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: Resolve conflicts and add Wrapt 3 as upper bound * Add wrapt 1.x/2.x test matrix for all ObjectProxy-using instrumentations Extend the wrapt1/wrapt2 test matrix to all instrumentations that use wrapt.ObjectProxy or wrapt.BaseObjectProxy: botocore, dbapi, grpc, pika, aiopg, httpx, and asyncpg. Changes: - tox.ini: Add {wrapt1,wrapt2} factor to envlist for all 7 packages; update deps to reference per-version test-requirements files - botocore/pyproject.toml: Add missing wrapt dependency (>= 1.0.0, < 3.0.0) - All base test-requirements files: Remove pinned wrapt== and Deprecated== - New test-requirements-wrapt1.txt / test-requirements-wrapt2.txt files for each package (using Deprecated>=1.2.18 for wrapt2 to avoid conflict with Deprecated==1.2.14 which requires wrapt<2) - Regenerate GitHub Actions workflows (including new test_3.yml due to expanded job count) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix CI failures: ruff formatting and lint wrapt version pin - utils.py: reformat multi-condition if statement to satisfy ruff line length requirement (fixes generate/precommit CI jobs) - tox.ini: pin wrapt>=1.0.0,<2.0.0 for lint envs of botocore, dbapi, grpc, and sio-pika; with wrapt 1.x removed from base test-requirements, lint envs were getting wrapt 2.x which caused pylint no-member errors on __wrapped__ (a C-extension attribute not visible to static analysis) Also add Deprecated==1.2.14 to same lint envs for consistency Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix remaining CI failures: unused imports and uv.lock - dbapi/__init__.py: remove unused bare 'import wrapt' (F401); the compat shim imports BaseObjectProxy directly from wrapt - grpc/_aio_server.py: remove unused 'import wrapt' (F401) and fix import ordering (I001) flagged by ruff pre-commit hook - uv.lock: regenerate after adding wrapt dependency to botocore pyproject.toml Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix aiopg lint wrapt pin, uv.lock format, and ruff blank lines - tox.ini: pin wrapt>=1.0.0,<2.0.0 + Deprecated==1.2.14 for lint-instrumentation-aiopg; aiopg source uses __wrapped__ heavily and pylint's no-member error appeared when wrapt 2.x was installed - uv.lock: regenerate using pre-commit hook (uv v0.9.30) to fix trailing-slash format on registry URLs - httpx/test_httpx_integration.py: add blank line before try/except block (ruff I001/E303 formatting fix) - pika/utils.py: add blank line before try/except block (same ruff fix) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix pylint E0611: disable no-name-in-module for BaseObjectProxy compat shim pylint with wrapt 1.x installed reports E0611 ('No name BaseObjectProxy in module wrapt') when it sees the try/except ImportError compat shim, even though the except branch provides a fallback. Add a per-line pylint disable comment to suppress this false positive. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix asyncpg test: use BaseObjectProxy compat shim for wrapt 2.x In wrapt 2.x, BoundFunctionWrapper no longer subclasses ObjectProxy (it subclasses BaseObjectProxy instead). Update the test to use the compat shim so isinstance checks pass with both wrapt 1.x and 2.x. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review comments: add wrapt 2.0.0+ comments and fix CHANGELOG - Add '# wrapt 2.0.0+' comment above BaseObjectProxy import in all try/except compat shim blocks to clarify why the pattern is used - Fix CHANGELOG.md PR link from #XXXX to #4203 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> * chore: Update changelog and workflows * Apply suggestions from code review Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> * fix: Update workflows again * Apply suggestions from code review Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> * Remove Deprecated version pins from test-requirements and tox.ini Deprecated>=1.2.14 was pinned because Deprecated==1.2.14 requires wrapt<2. Since pip automatically resolves compatible versions based on the wrapt constraint in each test env, explicit Deprecated pins are unnecessary. Remove them from all test-requirements-wrapt*.txt files and from lint env deps in tox.ini. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove stale .orig file leftover from rebase Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Move lint env wrapt pins from tox.ini into test-requirements files All dependencies should be managed via requirements.txt files rather than inline in tox.ini. Move wrapt>=1.0.0,<2.0.0 pins for lint environments into their respective test-requirements files: - instrumentation-grpc/test-requirements-1.txt - instrumentation-botocore/test-requirements-1.txt - instrumentation-dbapi/test-requirements.txt - instrumentation-aiopg/test-requirements.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Apply suggestions from code review * Update instrumentation/opentelemetry-instrumentation-botocore/test-requirements-1.txt * Update instrumentation/opentelemetry-instrumentation-grpc/test-requirements-1.txt * Update instrumentation/opentelemetry-instrumentation-dbapi/test-requirements.txt * Update instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt * Address latest PR feedback: botocore compat shim, exact wrapt versions, lint env refs - botocore/bedrock_utils.py: apply BaseObjectProxy compat shim to ConverseStreamWrapper and InvokeModelWithResponseStreamWrapper (both classes define __iter__ so BaseObjectProxy is correct) - All test-requirements-wrapt1.txt: pin wrapt==1.17.3 (exact version) - All test-requirements-wrapt2.txt: pin wrapt==2.1.2 (exact version) - tox.ini lint envs: switch to -wrapt2.txt files so lint runs with wrapt 2.x; remove wrapt pin from base test-requirements files (grpc/test-requirements-1.txt, botocore/test-requirements-1.txt, dbapi/test-requirements.txt, aiopg/test-requirements.txt) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: add pylint disable=no-member for __wrapped__ and abstract-method usages Add pylint: disable=no-member to all class definitions and usages of __wrapped__ that are invisible to pylint when using wrapt's C extension proxy types (BaseObjectProxy/ObjectProxy). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Getting Started • API Documentation • Getting In Touch (GitHub Discussions)
Contributing • Instrumentations
OpenTelemetry Python Contrib
The Python auto-instrumentation libraries for OpenTelemetry (per OTEP 0001)
Index
- Installation
- Releasing
- Semantic Convention status of instrumentations
- Contributing
- 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
depend on opentelemetry-sdk or another package that implements the API.
Please note that these libraries are currently in beta, and shouldn't generally be used in production environments.
Unless explicitly stated otherwise, any instrumentation here for a particular library is not developed or maintained by the authors of such library.
The
instrumentation/
directory includes OpenTelemetry instrumentation packages, which can be installed
separately as:
pip install opentelemetry-instrumentation-{integration}
To install the development versions of these packages instead, clone or fork this repo and do an editable install:
pip install -e ./instrumentation/opentelemetry-instrumentation-{integration}
Releasing
Maintainers release new versions of the packages in opentelemetry-python-contrib on a monthly cadence. See releases for all previous releases.
Contributions that enhance OTel for Python are welcome to be hosted upstream for the benefit of group collaboration. Maintainers will look for things like good documentation, good unit tests, and in general their own confidence when deciding to release a package with the stability guarantees that are implied with a 1.0 release.
To resolve this, members of the community are encouraged to commit to becoming a CODEOWNER for packages in -contrib that they feel experienced enough to maintain. CODEOWNERS can then follow the checklist below to release -contrib packages as 1.0 stable:
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.
- 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
- MUST have clear documentation for non-obvious usages of the package
- e.g. If an instrumentation package uses flags, a token as context, or parameters that are not typical of the
BaseInstrumentorclass, these are documented
- e.g. If an instrumentation package uses flags, a token as context, or parameters that are not typical of the
- After the release of
1.0, a CODEOWNER may no longer feel like they have the bandwidth to meet the responsibilities of maintaining the package. That's not a problem at all, life happens! However, if that is the case, we ask that the CODEOWNER please raise an issue indicating that they would like to be removed as a CODEOWNER so that they don't get pinged on future PRs. Ultimately, we hope to use that issue to find a new CODEOWNER.
Semantic Convention status of instrumentations
In our efforts to maintain optimal user experience and prevent breaking changes for transitioning into stable semantic conventions, OpenTelemetry Python is adopting the semantic convention migration plan for several instrumentations. Currently this plan is only being adopted for HTTP-related instrumentations, but will eventually cover all types. Please refer to the semconv status column of the instrumentation README of the current status of instrumentations' semantic conventions. The possible values are development, stable and migration referring to status of that particular semantic convention. Migration refers to an instrumentation that currently supports the migration plan.
Contributing
See CONTRIBUTING.md
We meet weekly on Thursday at 9AM PT. The meeting is subject to change depending on contributors' availability. Check the OpenTelemetry community calendar for specific dates and for the Zoom link.
Meeting notes are available as a public Google doc.
Maintainers
- Aaron Abbott, Google
- Leighton Chen, Microsoft
- Riccardo Magliocchetti, Elastic
For more information about the maintainer role, see the community repository.
Approvers
- Dylan Russell, Google
- Emídio Neto, Independent
- Héctor Hernández, Microsoft
- Jeremy Voss, Microsoft
- Keith Decker, Cisco/Splunk
- Liudmila Molkova, Grafana Labs
- Lukas Hering, Capital One
- Owais Lone, Splunk
- Pablo Collins, Splunk
- Sanket Mehta, Cisco
- Srikanth Chekuri, signoz.io
- Tammy Baylis, SolarWinds
For more information about the approver role, see the community repository.
Emeritus Maintainers
For more information about the emeritus role, see the community repository.
Emeritus Approvers
For more information about the emeritus role, see the community repository.