Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e5d0ddc
Add support for wrapt 2.x
blarghmatey Feb 13, 2026
477f5b9
Restructure wrapt test requirements
blarghmatey Feb 17, 2026
253820d
chore: Resolve conflicts and add Wrapt 3 as upper bound
blarghmatey Feb 20, 2026
de6e76f
Add wrapt 1.x/2.x test matrix for all ObjectProxy-using instrumentations
blarghmatey Feb 20, 2026
4b85975
Fix CI failures: ruff formatting and lint wrapt version pin
blarghmatey Feb 20, 2026
54e0a4b
Fix remaining CI failures: unused imports and uv.lock
blarghmatey Feb 20, 2026
cc1a9a6
Fix aiopg lint wrapt pin, uv.lock format, and ruff blank lines
blarghmatey Feb 20, 2026
9f7412f
Fix pylint E0611: disable no-name-in-module for BaseObjectProxy compa…
blarghmatey Feb 20, 2026
1799454
Fix asyncpg test: use BaseObjectProxy compat shim for wrapt 2.x
blarghmatey Feb 20, 2026
c4988c4
Address PR review comments: add wrapt 2.0.0+ comments and fix CHANGELOG
blarghmatey Mar 5, 2026
4a88554
Apply suggestions from code review
blarghmatey Mar 6, 2026
0ae757c
chore: Update changelog and workflows
blarghmatey Mar 6, 2026
a9e8e4a
Apply suggestions from code review
blarghmatey Mar 6, 2026
8232079
fix: Update workflows again
blarghmatey Mar 6, 2026
40fdef2
Apply suggestions from code review
blarghmatey Mar 6, 2026
2a51d7d
Remove Deprecated version pins from test-requirements and tox.ini
blarghmatey Mar 6, 2026
c93c4dc
Remove stale .orig file leftover from rebase
blarghmatey Mar 6, 2026
4316e3e
Move lint env wrapt pins from tox.ini into test-requirements files
blarghmatey Mar 6, 2026
f8d23eb
Merge branch 'main' into wrapt-2.0-support
blarghmatey Mar 8, 2026
ab54d2e
Apply suggestions from code review
xrmx Mar 9, 2026
70342a7
Update instrumentation/opentelemetry-instrumentation-botocore/test-re…
xrmx Mar 9, 2026
03cba58
Update instrumentation/opentelemetry-instrumentation-grpc/test-requir…
xrmx Mar 9, 2026
8ff257e
Update instrumentation/opentelemetry-instrumentation-dbapi/test-requi…
xrmx Mar 9, 2026
49f85c3
Update instrumentation/opentelemetry-instrumentation-aiopg/test-requi…
xrmx Mar 9, 2026
0908b58
Merge branch 'main' into wrapt-2.0-support
blarghmatey Mar 9, 2026
e330524
Address latest PR feedback: botocore compat shim, exact wrapt version…
blarghmatey Mar 9, 2026
35e71eb
Merge branch 'main' into wrapt-2.0-support
xrmx Mar 10, 2026
4c04cbf
fix: add pylint disable=no-member for __wrapped__ and abstract-method…
blarghmatey Mar 11, 2026
ce23074
Merge branch 'main' into wrapt-2.0-support
blarghmatey Mar 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
432 changes: 396 additions & 36 deletions .github/workflows/core_contrib_test_0.yml

Large diffs are not rendered by default.

1,350 changes: 675 additions & 675 deletions .github/workflows/test_0.yml

Large diffs are not rendered by default.

2,204 changes: 1,102 additions & 1,102 deletions .github/workflows/test_1.yml

Large diffs are not rendered by default.

2,686 changes: 1,799 additions & 887 deletions .github/workflows/test_2.yml

Large diffs are not rendered by default.

413 changes: 413 additions & 0 deletions .github/workflows/test_3.yml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ 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
Comment thread
blarghmatey marked this conversation as resolved.

### Added

- `opentelemetry-instrumentation-confluent-kafka`: Loosen confluent-kafka upper bound to <3.0.0
([#4289](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4289))
- `opentelemetry-instrumentation`: Add support for wrapt 2.x
([#4203](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4203))

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
dependencies = [
"opentelemetry-api ~= 1.5",
"opentelemetry-instrumentation == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
Comment thread
blarghmatey marked this conversation as resolved.
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"opentelemetry-util-http == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"opentelemetry-util-http == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-instrumentation-dbapi == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements.txt
wrapt==1.17.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements.txt
wrapt==2.1.2
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
aiopg==1.4.0
asgiref==3.8.1
async-timeout==4.0.3
Deprecated==1.2.14
Comment thread
blarghmatey marked this conversation as resolved.
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
Expand All @@ -10,7 +9,6 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"opentelemetry-api ~= 1.14",
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements.txt
wrapt==1.17.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements.txt
wrapt==2.1.2
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
asgiref==3.8.1
async-timeout==4.0.3
asyncpg==0.30.0
Deprecated==1.2.14
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
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-asyncpg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

import pytest
from asyncpg import Connection, Record, cursor
from wrapt import ObjectProxy

try:
# wrapt 2.0.0+
from wrapt import BaseObjectProxy # pylint: disable=no-name-in-module
except ImportError:
from wrapt import ObjectProxy as BaseObjectProxy

from opentelemetry import trace as trace_api
from opentelemetry.instrumentation.asyncpg import AsyncPGInstrumentor
Expand Down Expand Up @@ -50,7 +55,7 @@ def assert_wrapped(assert_fnc):
for method_name in methods:
method = getattr(cls, method_name, None)
assert_fnc(
isinstance(method, ObjectProxy),
isinstance(method, BaseObjectProxy),
f"{method} isinstance {type(method)}",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies = [
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"opentelemetry-propagator-aws-xray ~= 1.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
from typing import Any, Callable, Dict, Iterator, Sequence, Union

from botocore.eventstream import EventStream, EventStreamError
from wrapt import ObjectProxy

try:
# wrapt 2.0.0+
from wrapt import BaseObjectProxy # pylint: disable=no-name-in-module
except ImportError:
from wrapt import ObjectProxy as BaseObjectProxy

from opentelemetry._logs import LogRecord
from opentelemetry.context import get_current
Expand All @@ -37,7 +42,7 @@


# pylint: disable=abstract-method
class ConverseStreamWrapper(ObjectProxy):
class ConverseStreamWrapper(BaseObjectProxy):
"""Wrapper for botocore.eventstream.EventStream"""

def __init__(
Expand Down Expand Up @@ -157,7 +162,7 @@ def _handle_stream_error(self, exc):


# pylint: disable=abstract-method
class InvokeModelWithResponseStreamWrapper(ObjectProxy):
class InvokeModelWithResponseStreamWrapper(BaseObjectProxy):
"""Wrapper for botocore.eventstream.EventStream"""

def __init__(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements-0.txt
wrapt==1.17.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements-0.txt
wrapt==2.1.2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ certifi==2024.7.4
cffi==1.17.0
charset-normalizer==3.3.2
cryptography==43.0.1
Deprecated==1.2.14
docker==7.0.0
idna==3.7
iniconfig==2.0.0
Expand All @@ -31,7 +30,6 @@ tomli==2.0.1
typing_extensions==4.12.2
urllib3==1.26.19
Werkzeug==3.0.6
wrapt==1.16.0
xmltodict==0.13.0
zipp==3.19.2
-e opentelemetry-instrumentation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements-1.txt
wrapt==1.17.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements-1.txt
wrapt==2.1.2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ certifi==2024.7.4
cffi==1.17.0
charset-normalizer==3.3.2
cryptography==43.0.1
Deprecated==1.2.14
docker==7.0.0
idna==3.7
iniconfig==2.0.0
Expand All @@ -31,7 +30,6 @@ tomli==2.0.1
typing_extensions==4.12.2
urllib3==1.26.19
Werkzeug==3.0.6
wrapt==1.16.0
xmltodict==0.13.0
zipp==3.19.2
-e opentelemetry-instrumentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
dependencies = [
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-api ~= 1.12",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,14 @@
import re
from typing import Any, Awaitable, Callable, Generic, TypeVar

import wrapt
from wrapt import wrap_function_wrapper

try:
# wrapt 2.0.0+
from wrapt import BaseObjectProxy # pylint: disable=no-name-in-module
except ImportError:
from wrapt import ObjectProxy as BaseObjectProxy
Comment thread
blarghmatey marked this conversation as resolved.

from opentelemetry import trace as trace_api
from opentelemetry.instrumentation.dbapi.version import __version__
from opentelemetry.instrumentation.sqlcommenter_utils import _add_sql_comment
Expand Down Expand Up @@ -372,7 +377,7 @@ def instrument_connection(
Returns:
An instrumented connection.
"""
if isinstance(connection, wrapt.ObjectProxy):
if isinstance(connection, BaseObjectProxy):
_logger.warning("Connection already instrumented")
return connection

Expand Down Expand Up @@ -407,7 +412,7 @@ def uninstrument_connection(
Returns:
An uninstrumented connection.
"""
if isinstance(connection, wrapt.ObjectProxy):
if isinstance(connection, BaseObjectProxy):
return connection.__wrapped__

_logger.warning("Connection is not instrumented")
Expand Down Expand Up @@ -566,14 +571,14 @@ def get_connection_attributes(self, connection: object) -> None:


# pylint: disable=abstract-method
class TracedConnectionProxy(wrapt.ObjectProxy, Generic[ConnectionT]):
class TracedConnectionProxy(BaseObjectProxy, Generic[ConnectionT]):
# pylint: disable=unused-argument
def __init__(
self,
connection: ConnectionT,
db_api_integration: DatabaseApiIntegration | None = None,
):
wrapt.ObjectProxy.__init__(self, connection)
BaseObjectProxy.__init__(self, connection)
self._self_db_api_integration = db_api_integration

def __getattribute__(self, name: str):
Expand Down Expand Up @@ -800,14 +805,14 @@ async def traced_execution_async(


# pylint: disable=abstract-method
class TracedCursorProxy(wrapt.ObjectProxy, Generic[CursorT]):
class TracedCursorProxy(BaseObjectProxy, Generic[CursorT]):
# pylint: disable=unused-argument
def __init__(
self,
cursor: CursorT,
db_api_integration: DatabaseApiIntegration,
):
wrapt.ObjectProxy.__init__(self, cursor)
BaseObjectProxy.__init__(self, cursor)
self._self_cursor_tracer = CursorTracer[CursorT](db_api_integration)

def execute(self, *args: Any, **kwargs: Any):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements.txt
wrapt==1.17.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements.txt
wrapt==2.1.2
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
asgiref==3.8.1
Deprecated==1.2.14
iniconfig==2.0.0
packaging==24.0
pluggy==1.5.0
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.62b0.dev",
"opentelemetry-semantic-conventions == 0.62b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
"wrapt >= 1.0.0, < 3.0.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@

import grpc
import grpc.aio
import wrapt

try:
# wrapt 2.0.0+
from wrapt import BaseObjectProxy # pylint: disable=no-name-in-module
except ImportError:
from wrapt import ObjectProxy as BaseObjectProxy

from opentelemetry.semconv._incubating.attributes.rpc_attributes import (
RPC_GRPC_STATUS_CODE,
Expand All @@ -25,7 +30,7 @@


# pylint:disable=abstract-method
class _OpenTelemetryAioServicerContext(wrapt.ObjectProxy):
class _OpenTelemetryAioServicerContext(BaseObjectProxy):
def __init__(self, servicer_context, active_span):
super().__init__(servicer_context)
self._self_active_span = active_span
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements-0.txt
wrapt==1.17.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r test-requirements-0.txt
wrapt==2.1.2
Loading
Loading