From a084c2c7df030e5c9284a50bff1faced4adc36ce Mon Sep 17 00:00:00 2001 From: Rocky Ken <119533257+rocky-ken@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:19:20 -0700 Subject: [PATCH 1/3] Add fallback decoding for asgi headers (#2837) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add latin-1 fallback decoding for asgi headers * Add comment for ASGI encoding spec and change to unicode_escape * add unit test for non-utf8 header decoding * add changelog * revert lint * code review changes * Fix changelog * Add ASGIGetter test --------- Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com> Co-authored-by: Riccardo Magliocchetti --- CHANGELOG.md | 2 ++ .../instrumentation/asgi/__init__.py | 20 ++++++++++++---- .../tests/test_asgi_custom_headers.py | 24 +++++++++++++++++-- .../tests/test_getter.py | 10 ++++++++ 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa1ab2ba3..a060517cdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#2537](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2537)) - `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-fastapi` Add ability to disable internal HTTP send and receive spans ([#2802](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2802)) +- `opentelemetry-instrumentation-asgi` Add fallback decoding for ASGI headers + ([#2837](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2837)) ### Breaking changes diff --git a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py index d25ca41017..bc45eacaa4 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py @@ -284,9 +284,9 @@ def get( # ASGI header keys are in lower case key = key.lower() decoded = [ - _value.decode("utf8") + _decode_header_item(_value) for (_key, _value) in headers - if _key.decode("utf8").lower() == key + if _decode_header_item(_key).lower() == key ] if not decoded: return None @@ -294,7 +294,7 @@ def get( def keys(self, carrier: dict) -> typing.List[str]: headers = carrier.get("headers") or [] - return [_key.decode("utf8") for (_key, _value) in headers] + return [_decode_header_item(_key) for (_key, _value) in headers] asgi_getter = ASGIGetter() @@ -410,7 +410,9 @@ def collect_custom_headers_attributes( if raw_headers: for key, value in raw_headers: # Decode headers before processing. - headers[key.decode()].append(value.decode()) + headers[_decode_header_item(key)].append( + _decode_header_item(value) + ) return sanitize.sanitize_header_values( headers, @@ -979,3 +981,13 @@ def _parse_active_request_count_attrs( _server_active_requests_count_attrs_new, sem_conv_opt_in_mode, ) + + +def _decode_header_item(value): + try: + return value.decode("utf-8") + except ValueError: + # ASGI header encoding specs, see: + # - https://asgi.readthedocs.io/en/latest/specs/www.html#wsgi-encoding-differences (see: WSGI encoding differences) + # - https://docs.python.org/3/library/codecs.html#text-encodings (see: Text Encodings) + return value.decode("unicode_escape") diff --git a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_custom_headers.py b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_custom_headers.py index f6cb05fbda..1b191e30e7 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_custom_headers.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_custom_headers.py @@ -48,6 +48,14 @@ async def http_app_with_custom_headers(scope, receive, send): b"my-custom-regex-value-3,my-custom-regex-value-4", ), (b"my-secret-header", b"my-secret-value"), + ( + b"non-utf8-header", + b"Moto Z\xb2", + ), + ( + b"Moto-Z\xb2-non-utf8-header-key", + b"Moto Z\xb2", + ), ], } ) @@ -130,6 +138,14 @@ async def test_http_custom_request_headers_in_span_attributes(self): (b"Regex-Test-Header-1", b"Regex Test Value 1"), (b"regex-test-header-2", b"RegexTestValue2,RegexTestValue3"), (b"My-Secret-Header", b"My Secret Value"), + ( + b"non-utf8-header", + b"Moto Z\xb2", + ), + ( + b"Moto-Z\xb2-non-utf8-header-key", + b"Moto Z\xb2", + ), ] ) self.seed_app(self.app) @@ -147,6 +163,8 @@ async def test_http_custom_request_headers_in_span_attributes(self): "http.request.header.regex_test_header_2": ( "RegexTestValue2,RegexTestValue3", ), + "http.request.header.non_utf8_header": ("Moto Z²",), + "http.request.header.moto_z²_non_utf8_header_key": ("Moto Z²",), "http.request.header.my_secret_header": ("[REDACTED]",), } for span in span_list: @@ -223,6 +241,8 @@ async def test_http_custom_response_headers_in_span_attributes(self): "my-custom-regex-value-3,my-custom-regex-value-4", ), "http.response.header.my_secret_header": ("[REDACTED]",), + "http.response.header.non_utf8_header": ("Moto Z²",), + "http.response.header.moto_z²_non_utf8_header_key": ("Moto Z²",), } for span in span_list: if span.kind == SpanKind.SERVER: @@ -418,8 +438,8 @@ async def test_websocket_custom_response_headers_not_in_span_attributes( SANITIZE_FIELDS_TEST_VALUE = ".*my-secret.*" -SERVER_REQUEST_TEST_VALUE = "Custom-Test-Header-1,Custom-Test-Header-2,Custom-Test-Header-3,Regex-Test-Header-.*,Regex-Invalid-Test-Header-.*,.*my-secret.*" -SERVER_RESPONSE_TEST_VALUE = "Custom-Test-Header-1,Custom-Test-Header-2,Custom-Test-Header-3,my-custom-regex-header-.*,invalid-regex-header-.*,.*my-secret.*" +SERVER_REQUEST_TEST_VALUE = "Custom-Test-Header-1,Custom-Test-Header-2,Custom-Test-Header-3,Regex-Test-Header-.*,Regex-Invalid-Test-Header-.*,.*my-secret.*,non-utf8-header,Moto-Z²-non-utf8-header-key" +SERVER_RESPONSE_TEST_VALUE = "Custom-Test-Header-1,Custom-Test-Header-2,Custom-Test-Header-3,my-custom-regex-header-.*,invalid-regex-header-.*,.*my-secret.*,non-utf8-header,Moto-Z²-non-utf8-header-key" class TestCustomHeadersEnv(TestCustomHeaders): diff --git a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_getter.py b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_getter.py index 26bb652b50..3f76e0e5ce 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_getter.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_getter.py @@ -69,3 +69,13 @@ def test_keys(self): expected_val, "Should be equal", ) + + def test_non_utf8_headers(self): + getter = ASGIGetter() + carrier = {"headers": [(b"test-key", b"Moto Z\xb2")]} + expected_val = ["Moto Z²"] + self.assertEqual( + getter.get(carrier, "test-key"), + expected_val, + "Should be equal", + ) From f8bb28928cccdb1236a9aab1dec9cb0179cbb9be Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 26 Sep 2024 08:52:02 +0200 Subject: [PATCH 2/3] Update test requirements for work with Python 3.13 (#2887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added deb to make cassandra tests work with python 3.13 * Bumped cffi to work with Python 3.13 * Fixed some test-requirements for Python 3.13 * Updated typing_extensions everywhere --------- Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com> --- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements-2.txt | 2 +- .../test-requirements-3.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 4 ++-- .../test-requirements.txt | 2 +- .../test-requirements.txt | 4 ++-- .../test-requirements.txt | 3 ++- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements-2.txt | 2 +- .../test-requirements-3.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements-2.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements-2.txt | 2 +- .../test-requirements.txt | 8 ++++---- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements-2.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements-2.txt | 2 +- .../test-requirements-3.txt | 2 +- .../test-requirements-4.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements-0.txt | 4 ++-- .../test-requirements-1.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 8 ++++---- .../test-requirements.txt | 2 +- .../test-requirements-0.txt | 2 +- .../test-requirements-1.txt | 2 +- .../test-requirements.txt | 2 +- opentelemetry-distro/test-requirements.txt | 2 +- opentelemetry-instrumentation/test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../test-requirements.txt | 2 +- .../opentelemetry-sdk-extension-aws/test-requirements.txt | 2 +- tox.ini | 2 +- util/opentelemetry-util-http/test-requirements.txt | 2 +- 81 files changed, 91 insertions(+), 90 deletions(-) diff --git a/exporter/opentelemetry-exporter-prometheus-remote-write/test-requirements.txt b/exporter/opentelemetry-exporter-prometheus-remote-write/test-requirements.txt index 5836dc9764..318e1e68d5 100644 --- a/exporter/opentelemetry-exporter-prometheus-remote-write/test-requirements.txt +++ b/exporter/opentelemetry-exporter-prometheus-remote-write/test-requirements.txt @@ -16,7 +16,7 @@ pytest==7.4.4 python-snappy==0.7.1 requests==2.32.3 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 urllib3==2.2.2 wrapt==1.16.0 zipp==3.19.2 diff --git a/exporter/opentelemetry-exporter-richconsole/test-requirements.txt b/exporter/opentelemetry-exporter-richconsole/test-requirements.txt index 0ef562821f..a63c91d0d8 100644 --- a/exporter/opentelemetry-exporter-richconsole/test-requirements.txt +++ b/exporter/opentelemetry-exporter-richconsole/test-requirements.txt @@ -12,7 +12,7 @@ Pygments==2.17.2 pytest==7.4.4 rich==13.7.1 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e exporter/opentelemetry-exporter-richconsole diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt index de853e16c9..26c7046817 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt @@ -12,7 +12,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 yarl==1.9.4 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt index dbfb89fe82..fac907831a 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt @@ -12,7 +12,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 yarl==1.9.4 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt index 6a95bd69f0..ad807173e8 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt @@ -12,7 +12,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 yarl==1.9.4 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-3.txt b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-3.txt index 82e742a1f4..766cc6cf86 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-3.txt +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-3.txt @@ -12,7 +12,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 yarl==1.9.4 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-aiohttp-client/test-requirements.txt index dee4736133..f4da0edc25 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/test-requirements.txt @@ -23,7 +23,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 requests==2.32.3 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 urllib3==2.2.2 Werkzeug==3.0.3 wrapt==1.16.0 diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-server/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-aiohttp-server/test-requirements.txt index e6dff52db9..d84eccb649 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-server/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-server/test-requirements.txt @@ -15,7 +15,7 @@ pytest==7.4.4 pytest-aiohttp==1.0.5 pytest-asyncio==0.23.5 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 yarl==1.9.4 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt index 1443104081..df527586f7 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-aiopg/test-requirements.txt @@ -10,7 +10,7 @@ psycopg2-binary==2.9.9 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt index 18a11500e1..de88049226 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-asgi/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt index 7f20d1497c..190e1cbe02 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-asyncio/test-requirements.txt @@ -8,7 +8,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 pytest-asyncio==0.23.5 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-asyncpg/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-asyncpg/test-requirements.txt index 60cef50a7a..bb41329e66 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncpg/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-asyncpg/test-requirements.txt @@ -9,7 +9,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-aws-lambda/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-aws-lambda/test-requirements.txt index 8d9fe19483..a80527dd36 100644 --- a/instrumentation/opentelemetry-instrumentation-aws-lambda/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-aws-lambda/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-boto/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-boto/test-requirements.txt index fe6467d1c4..bb56100ecb 100644 --- a/instrumentation/opentelemetry-instrumentation-boto/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-boto/test-requirements.txt @@ -3,7 +3,7 @@ boto==2.49.0 boto3==1.34.44 botocore==1.34.44 certifi==2024.7.4 -cffi==1.16.0 +cffi==1.17.0 charset-normalizer==3.3.2 cryptography==42.0.5 Deprecated==1.2.14 @@ -28,7 +28,7 @@ responses==0.25.0 s3transfer==0.10.0 six==1.16.0 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 urllib3==1.26.19 Werkzeug==2.3.8 wrapt==1.16.0 diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-boto3sqs/test-requirements.txt index d8a9c38315..dfa17c79a7 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/test-requirements.txt @@ -13,7 +13,7 @@ python-dateutil==2.8.2 s3transfer==0.10.0 six==1.16.0 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 urllib3==1.26.19 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-botocore/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-botocore/test-requirements.txt index a89fdf2e30..f0ceb9f467 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-botocore/test-requirements.txt @@ -3,7 +3,7 @@ aws-xray-sdk==2.12.1 boto3==1.28.80 botocore==1.31.80 certifi==2024.7.4 -cffi==1.16.0 +cffi==1.17.0 charset-normalizer==3.3.2 cryptography==42.0.5 Deprecated==1.2.14 @@ -28,7 +28,7 @@ responses==0.25.0 s3transfer==0.7.0 six==1.16.0 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 urllib3==1.26.19 Werkzeug==3.0.3 wrapt==1.16.0 diff --git a/instrumentation/opentelemetry-instrumentation-cassandra/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-cassandra/test-requirements.txt index 189b2f65d0..25bf51f2a5 100644 --- a/instrumentation/opentelemetry-instrumentation-cassandra/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-cassandra/test-requirements.txt @@ -1,5 +1,6 @@ asgiref==3.8.1 cassandra-driver==3.29.0 +pyasyncore==1.0.4 # for python 3.13 (should removed when cassandra-driver replaces asyncore with recommended asyncio) click==8.1.7 Deprecated==1.2.14 geomet==0.2.1.post1 @@ -13,7 +14,7 @@ PyYAML==6.0.1 scylla-driver==3.26.6 six==1.16.0 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-celery/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-celery/test-requirements-0.txt index fcf838fc32..1e018aae6e 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-celery/test-requirements-0.txt @@ -19,7 +19,7 @@ pytest==7.4.4 python-dateutil==2.8.2 six==1.16.0 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 tzdata==2024.1 vine==5.1.0 wcwidth==0.2.13 diff --git a/instrumentation/opentelemetry-instrumentation-celery/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-celery/test-requirements-1.txt index 76b2f03d12..c7d494aceb 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-celery/test-requirements-1.txt @@ -18,7 +18,7 @@ pytest==7.4.4 python-dateutil==2.8.2 six==1.16.0 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 tzdata==2024.1 vine==5.1.0 wcwidth==0.2.13 diff --git a/instrumentation/opentelemetry-instrumentation-confluent-kafka/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-confluent-kafka/test-requirements.txt index f78f498620..7f389a12af 100644 --- a/instrumentation/opentelemetry-instrumentation-confluent-kafka/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-confluent-kafka/test-requirements.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-dbapi/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-dbapi/test-requirements.txt index f76b488d90..1275616d45 100644 --- a/instrumentation/opentelemetry-instrumentation-dbapi/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-dbapi/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt index 9d7ee964fe..6c1b8337a4 100644 --- a/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-django/test-requirements-0.txt @@ -10,7 +10,7 @@ pytest==7.4.4 pytz==2024.1 sqlparse==0.5.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt index 9c21d2dfd4..357fd273f5 100644 --- a/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-django/test-requirements-1.txt @@ -10,7 +10,7 @@ pytest==7.4.4 pytz==2024.1 sqlparse==0.5.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt index d3a55aae34..1d15b1336b 100644 --- a/instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt +++ b/instrumentation/opentelemetry-instrumentation-django/test-requirements-2.txt @@ -10,7 +10,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 sqlparse==0.5.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt b/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt index 89923379d3..fa483e5ade 100644 --- a/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt +++ b/instrumentation/opentelemetry-instrumentation-django/test-requirements-3.txt @@ -9,7 +9,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 sqlparse==0.5.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-0.txt index 55eabe1ef5..977a440c85 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-0.txt @@ -11,7 +11,7 @@ pytest==7.4.4 python-dateutil==2.8.2 six==1.16.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 urllib3==1.26.19 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-1.txt index 2fab7287ad..44451736c8 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-1.txt @@ -11,7 +11,7 @@ pytest==7.4.4 python-dateutil==2.8.2 six==1.16.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 urllib3==1.26.19 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-2.txt index 5f2ccd41ac..a02a9c0270 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-2.txt +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-2.txt @@ -12,7 +12,7 @@ pytest==7.4.4 python-dateutil==2.8.2 six==1.16.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 urllib3==2.2.2 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt index 6967c57b6d..11a84eef70 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-0.txt @@ -10,7 +10,7 @@ pytest==7.4.4 python-mimeparse==1.6.0 six==1.16.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt index e535925b14..9d646f3bbb 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-1.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt index 30d21e2773..d2a921eb87 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt +++ b/instrumentation/opentelemetry-instrumentation-falcon/test-requirements-2.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-fastapi/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-fastapi/test-requirements.txt index 927e68f94e..0417301559 100644 --- a/instrumentation/opentelemetry-instrumentation-fastapi/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-fastapi/test-requirements.txt @@ -1,4 +1,4 @@ -annotated-types==0.6.0 +annotated-types==0.7.0 anyio==4.3.0 asgiref==3.8.1 certifi==2024.7.4 @@ -15,14 +15,14 @@ iniconfig==2.0.0 packaging==24.0 pluggy==1.5.0 py-cpuinfo==9.0.0 -pydantic==2.6.2 -pydantic_core==2.16.3 +pydantic==2.8.2 +pydantic_core==2.20.1 pytest==7.4.4 requests==2.32.3 sniffio==1.3.0 starlette==0.36.3 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 urllib3==2.2.2 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt index 0bd176848d..e6fa669267 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-0.txt @@ -12,7 +12,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 Werkzeug==2.3.8 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt index d73ab497b5..ecd3f680d8 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-1.txt @@ -12,7 +12,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 Werkzeug==2.3.8 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt index 299a347d66..da044a29e9 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt +++ b/instrumentation/opentelemetry-instrumentation-flask/test-requirements-2.txt @@ -13,7 +13,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 Werkzeug==3.0.3 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-0.txt index 83ec6e8e70..cdea5fca4b 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-0.txt @@ -9,7 +9,7 @@ protobuf==3.20.3 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-1.txt index d77d67148a..9b2d088da3 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-1.txt @@ -9,7 +9,7 @@ protobuf==3.20.3 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-httpx/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-httpx/test-requirements-0.txt index 28b475a3a4..34eac9d10c 100644 --- a/instrumentation/opentelemetry-instrumentation-httpx/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-httpx/test-requirements-0.txt @@ -17,7 +17,7 @@ respx==0.17.1 rfc3986==1.5.0 sniffio==1.3.1 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-httpx/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-httpx/test-requirements-1.txt index 42c032a546..93b4d024cb 100644 --- a/instrumentation/opentelemetry-instrumentation-httpx/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-httpx/test-requirements-1.txt @@ -16,7 +16,7 @@ pytest==7.4.4 respx==0.20.2 sniffio==1.3.1 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-jinja2/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-jinja2/test-requirements.txt index 59eabe6997..c7a30b8eb5 100644 --- a/instrumentation/opentelemetry-instrumentation-jinja2/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-jinja2/test-requirements.txt @@ -9,7 +9,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-kafka-python/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-kafka-python/test-requirements.txt index 6582cf875b..a042ce833e 100644 --- a/instrumentation/opentelemetry-instrumentation-kafka-python/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-kafka-python/test-requirements.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-logging/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-logging/test-requirements.txt index c0d2f044c8..600d066cc1 100644 --- a/instrumentation/opentelemetry-instrumentation-logging/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-logging/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-mysql/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-mysql/test-requirements-0.txt index bf93434850..22e61d9df3 100644 --- a/instrumentation/opentelemetry-instrumentation-mysql/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-mysql/test-requirements-0.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-mysqlclient/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-mysqlclient/test-requirements.txt index 8c3ed72f35..3dfa1b161d 100644 --- a/instrumentation/opentelemetry-instrumentation-mysqlclient/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-mysqlclient/test-requirements.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pika/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-pika/test-requirements-0.txt index e06bc0b395..871d4feac1 100644 --- a/instrumentation/opentelemetry-instrumentation-pika/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-pika/test-requirements-0.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pika/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-pika/test-requirements-1.txt index 8928f655c8..b1c9e9094f 100644 --- a/instrumentation/opentelemetry-instrumentation-pika/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-pika/test-requirements-1.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-psycopg/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-psycopg/test-requirements-0.txt index 42bbac77d9..93ea09ca15 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-psycopg/test-requirements-0.txt @@ -9,7 +9,7 @@ psycopg==3.1.18 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-psycopg/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-psycopg/test-requirements-1.txt index 1f7fb59f2d..096d31599a 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-psycopg/test-requirements-1.txt @@ -8,7 +8,7 @@ psycopg==3.1.18 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements.txt index aa98fa93d0..5ae59dc5ea 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/test-requirements.txt @@ -8,7 +8,7 @@ psycopg2==2.9.9 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-0.txt index 2c6e0e2749..25e0f03bd6 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-0.txt @@ -9,7 +9,7 @@ pymemcache==1.3.5 pytest==7.4.4 six==1.16.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-1.txt index 36db8d4416..3005dc7aa8 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-1.txt @@ -9,7 +9,7 @@ pymemcache==2.2.2 pytest==7.4.4 six==1.16.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-2.txt index 3e0359f731..4c259345c6 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-2.txt +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-2.txt @@ -9,7 +9,7 @@ pymemcache==3.4.1 pytest==7.4.4 six==1.16.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-3.txt b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-3.txt index 916c9c9c3a..b0e2147639 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-3.txt +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-3.txt @@ -9,7 +9,7 @@ pymemcache==3.4.2 pytest==7.4.4 six==1.16.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-4.txt b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-4.txt index e90a138ff8..36d0164961 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-4.txt +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/test-requirements-4.txt @@ -8,7 +8,7 @@ py-cpuinfo==9.0.0 pymemcache==4.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pymongo/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-pymongo/test-requirements.txt index 6c8de553b6..a9319d5fdb 100644 --- a/instrumentation/opentelemetry-instrumentation-pymongo/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-pymongo/test-requirements.txt @@ -9,7 +9,7 @@ py-cpuinfo==9.0.0 pymongo==4.6.3 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pymysql/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-pymysql/test-requirements.txt index 7ad69f2b81..b1496da4e6 100644 --- a/instrumentation/opentelemetry-instrumentation-pymysql/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-pymysql/test-requirements.txt @@ -8,7 +8,7 @@ py-cpuinfo==9.0.0 PyMySQL==1.1.1 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt index 6f33f33449..423838f23e 100644 --- a/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-pyramid/test-requirements.txt @@ -13,7 +13,7 @@ pyramid==2.0.2 pytest==7.4.4 tomli==2.0.1 translationstring==1.4 -typing_extensions==4.9.0 +typing_extensions==4.12.2 venusian==3.1.0 WebOb==1.8.8 Werkzeug==3.0.3 diff --git a/instrumentation/opentelemetry-instrumentation-redis/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-redis/test-requirements.txt index 7b8d8459b7..4690006ef1 100644 --- a/instrumentation/opentelemetry-instrumentation-redis/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-redis/test-requirements.txt @@ -10,7 +10,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 redis==5.0.1 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-remoulade/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-remoulade/test-requirements.txt index b850e46f9f..a299e145a1 100644 --- a/instrumentation/opentelemetry-instrumentation-remoulade/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-remoulade/test-requirements.txt @@ -12,7 +12,7 @@ pytz==2024.1 remoulade==3.2.0 six==1.16.0 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt index 9f40c6d5b2..a201206f0f 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt @@ -12,7 +12,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 requests==2.32.3 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 urllib3==2.2.2 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-0.txt index 45992bc2e1..cccdc3cb63 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-0.txt @@ -1,5 +1,5 @@ asgiref==3.8.1 -cffi==1.15.1 +cffi==1.17.0 Deprecated==1.2.14 importlib-metadata==6.11.0 iniconfig==2.0.0 @@ -9,7 +9,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 SQLAlchemy==1.1.18 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-1.txt index eb1ee371b7..b275f4e30e 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-1.txt @@ -10,7 +10,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 SQLAlchemy==1.4.51 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-sqlite3/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-sqlite3/test-requirements.txt index e260861814..2469d354d3 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlite3/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-sqlite3/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt index d81a15a40c..7f46b46981 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt @@ -18,7 +18,7 @@ requests==2.32.3 sniffio==1.3.0 starlette==0.13.8 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 urllib3==2.2.2 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-system-metrics/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-system-metrics/test-requirements.txt index 76f2f2a4e7..710e4bdf7f 100644 --- a/instrumentation/opentelemetry-instrumentation-system-metrics/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-system-metrics/test-requirements.txt @@ -8,7 +8,7 @@ psutil==6.0.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-threading/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-threading/test-requirements.txt index 2d13857e9e..84c3bb4d29 100644 --- a/instrumentation/opentelemetry-instrumentation-threading/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-threading/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-tornado/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-tornado/test-requirements.txt index 236c45f87b..209c07e523 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-tornado/test-requirements.txt @@ -19,7 +19,7 @@ pytest==7.4.4 requests==2.32.3 tomli==2.0.1 tornado==6.4.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 urllib3==2.2.2 Werkzeug==3.0.3 wrapt==1.16.0 diff --git a/instrumentation/opentelemetry-instrumentation-tortoiseorm/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-tortoiseorm/test-requirements.txt index 31b044a2f3..4ec6d195bf 100644 --- a/instrumentation/opentelemetry-instrumentation-tortoiseorm/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-tortoiseorm/test-requirements.txt @@ -1,5 +1,5 @@ aiosqlite==0.17.0 -annotated-types==0.6.0 +annotated-types==0.7.0 asgiref==3.8.1 Deprecated==1.2.14 importlib-metadata==6.11.0 @@ -8,14 +8,14 @@ iso8601==1.1.0 packaging==24.0 pluggy==1.5.0 py-cpuinfo==9.0.0 -pydantic==2.6.2 -pydantic_core==2.16.3 +pydantic==2.8.2 +pydantic_core==2.20.1 pypika-tortoise==0.1.6 pytest==7.4.4 pytz==2024.1 tomli==2.0.1 tortoise-orm==0.20.0 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-urllib/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-urllib/test-requirements.txt index 06bc8322dc..998ca77f6a 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-urllib/test-requirements.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-urllib3/test-requirements-0.txt index e7392b0c31..ad29eb1263 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/test-requirements-0.txt +++ b/instrumentation/opentelemetry-instrumentation-urllib3/test-requirements-0.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 urllib3==1.26.19 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-urllib3/test-requirements-1.txt index 21cb3acbe6..48406b222d 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/test-requirements-1.txt +++ b/instrumentation/opentelemetry-instrumentation-urllib3/test-requirements-1.txt @@ -8,7 +8,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 urllib3==2.2.2 wrapt==1.16.0 zipp==3.19.2 diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt index d63bd5a637..acabba1abf 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-wsgi/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.9.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/opentelemetry-distro/test-requirements.txt b/opentelemetry-distro/test-requirements.txt index 050054c39b..4f63e9e7b6 100644 --- a/opentelemetry-distro/test-requirements.txt +++ b/opentelemetry-distro/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/opentelemetry-instrumentation/test-requirements.txt b/opentelemetry-instrumentation/test-requirements.txt index 31f1ef76ab..24a5a56daf 100644 --- a/opentelemetry-instrumentation/test-requirements.txt +++ b/opentelemetry-instrumentation/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/propagator/opentelemetry-propagator-aws-xray/test-requirements.txt b/propagator/opentelemetry-propagator-aws-xray/test-requirements.txt index 4587d87629..8f5b428ba4 100644 --- a/propagator/opentelemetry-propagator-aws-xray/test-requirements.txt +++ b/propagator/opentelemetry-propagator-aws-xray/test-requirements.txt @@ -12,7 +12,7 @@ pytest==7.4.4 pytest-benchmark==4.0.0 requests==2.32.3 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 urllib3==2.2.2 wrapt==1.16.0 zipp==3.19.2 diff --git a/propagator/opentelemetry-propagator-ot-trace/test-requirements.txt b/propagator/opentelemetry-propagator-ot-trace/test-requirements.txt index b556c4f0cc..4a97065065 100644 --- a/propagator/opentelemetry-propagator-ot-trace/test-requirements.txt +++ b/propagator/opentelemetry-propagator-ot-trace/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e propagator/opentelemetry-propagator-ot-trace diff --git a/resource/opentelemetry-resource-detector-azure/test-requirements.txt b/resource/opentelemetry-resource-detector-azure/test-requirements.txt index 2b29359fbb..fe04c99490 100644 --- a/resource/opentelemetry-resource-detector-azure/test-requirements.txt +++ b/resource/opentelemetry-resource-detector-azure/test-requirements.txt @@ -6,7 +6,7 @@ packaging==24.0 pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e opentelemetry-instrumentation diff --git a/resource/opentelemetry-resource-detector-container/test-requirements.txt b/resource/opentelemetry-resource-detector-container/test-requirements.txt index f7b5b71fcf..7cf0d49001 100644 --- a/resource/opentelemetry-resource-detector-container/test-requirements.txt +++ b/resource/opentelemetry-resource-detector-container/test-requirements.txt @@ -7,7 +7,7 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e resource/opentelemetry-resource-detector-container diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/test-requirements.txt b/sdk-extension/opentelemetry-sdk-extension-aws/test-requirements.txt index 1fa968a8b3..3b44b54a61 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/test-requirements.txt +++ b/sdk-extension/opentelemetry-sdk-extension-aws/test-requirements.txt @@ -8,7 +8,7 @@ py-cpuinfo==9.0.0 pytest==7.4.4 pytest-benchmark==4.0.0 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 wrapt==1.16.0 zipp==3.19.2 -e sdk-extension/opentelemetry-sdk-extension-aws diff --git a/tox.ini b/tox.ini index 976e5968b0..e0a5a71131 100644 --- a/tox.ini +++ b/tox.ini @@ -1272,7 +1272,7 @@ deps = SQLAlchemy==1.4.52 texttable==1.7.0 tomli==2.0.1 - typing_extensions==4.10.0 + typing_extensions==4.12.2 tzdata==2024.1 urllib3==1.26.19 vine==5.1.0 diff --git a/util/opentelemetry-util-http/test-requirements.txt b/util/opentelemetry-util-http/test-requirements.txt index 1769daa094..7c71ae2ef3 100644 --- a/util/opentelemetry-util-http/test-requirements.txt +++ b/util/opentelemetry-util-http/test-requirements.txt @@ -7,5 +7,5 @@ pluggy==1.5.0 py-cpuinfo==9.0.0 pytest==7.4.4 tomli==2.0.1 -typing_extensions==4.10.0 +typing_extensions==4.12.2 -e opentelemetry-instrumentation From d52f42fb7f36c5448395f4cf842523ee9f3e01c9 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Thu, 26 Sep 2024 18:00:31 +0500 Subject: [PATCH 3/3] feat(opentelemetry-instrumentation-aiokafka): wrap getone instead of anext, add tests (#2874) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add tests * add to CHANGELOG * add tests for baggage * wrap getone instead of __anext__ * split sync and async tests (fix review) * add dimastbk to component_owners.yml for aiokafka * Update CHANGELOG.md --------- Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com> Co-authored-by: Riccardo Magliocchetti --- .github/component_owners.yml | 3 + CHANGELOG.md | 6 + .../instrumentation/aiokafka/__init__.py | 8 +- .../instrumentation/aiokafka/utils.py | 2 +- .../tests/test_instrumentation.py | 290 +++++++++++++++++- .../tests/test_utils.py | 4 +- tox.ini | 1 + 7 files changed, 302 insertions(+), 12 deletions(-) diff --git a/.github/component_owners.yml b/.github/component_owners.yml index e3ca06b450..dcc1013476 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -61,5 +61,8 @@ components: instrumentation/opentelemetry-instrumentation-psycopg: - federicobond + instrumentation/opentelemetry-instrumentation-aiokafka: + - dimastbk + processor/opentelemetry-processor-baggage: - codeboten diff --git a/CHANGELOG.md b/CHANGELOG.md index a060517cdf..30440c2dce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `opentelemetry-instrumentation-aiokafka` Add instrumentor and auto instrumentation support for aiokafka ([#2082](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2082)) + +### Fixed + +- `opentelemetry-instrumentation-aiokafka` Wrap `AIOKafkaConsumer.getone()` instead of `AIOKafkaConsumer.__anext__` + ([#2874](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2874)) + ## Version 1.27.0/0.48b0 () ### Added diff --git a/instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/__init__.py b/instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/__init__.py index 5b2b0cd0e8..7d994be622 100644 --- a/instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/__init__.py @@ -76,7 +76,7 @@ async def async_consume_hook(span, record, args, kwargs): from opentelemetry import trace from opentelemetry.instrumentation.aiokafka.package import _instruments from opentelemetry.instrumentation.aiokafka.utils import ( - _wrap_anext, + _wrap_getone, _wrap_send, ) from opentelemetry.instrumentation.aiokafka.version import __version__ @@ -126,10 +126,10 @@ def _instrument(self, **kwargs): ) wrap_function_wrapper( aiokafka.AIOKafkaConsumer, - "__anext__", - _wrap_anext(tracer, async_consume_hook), + "getone", + _wrap_getone(tracer, async_consume_hook), ) def _uninstrument(self, **kwargs): unwrap(aiokafka.AIOKafkaProducer, "send") - unwrap(aiokafka.AIOKafkaConsumer, "__anext__") + unwrap(aiokafka.AIOKafkaConsumer, "getone") diff --git a/instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/utils.py b/instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/utils.py index 3c54ce1500..cae0d97717 100644 --- a/instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/utils.py +++ b/instrumentation/opentelemetry-instrumentation-aiokafka/src/opentelemetry/instrumentation/aiokafka/utils.py @@ -335,7 +335,7 @@ async def _create_consumer_span( context.detach(token) -def _wrap_anext( +def _wrap_getone( tracer: Tracer, async_consume_hook: ConsumeHookT ) -> Callable[..., Awaitable[aiokafka.ConsumerRecord]]: async def _traced_next( diff --git a/instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_instrumentation.py b/instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_instrumentation.py index 1c4e5e3d10..8211566239 100644 --- a/instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_instrumentation.py @@ -11,15 +11,29 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from unittest import TestCase -from aiokafka import AIOKafkaConsumer, AIOKafkaProducer +import uuid +from typing import Any, List, Sequence, Tuple +from unittest import IsolatedAsyncioTestCase, TestCase, mock + +from aiokafka import ( + AIOKafkaConsumer, + AIOKafkaProducer, + ConsumerRecord, + TopicPartition, +) from wrapt import BoundFunctionWrapper +from opentelemetry import baggage, context from opentelemetry.instrumentation.aiokafka import AIOKafkaInstrumentor +from opentelemetry.sdk.trace import ReadableSpan +from opentelemetry.semconv._incubating.attributes import messaging_attributes +from opentelemetry.semconv.attributes import server_attributes +from opentelemetry.test.test_base import TestBase +from opentelemetry.trace import SpanKind, format_trace_id, set_span_in_context -class TestAIOKafka(TestCase): +class TestAIOKafkaInstrumentor(TestCase): def test_instrument_api(self) -> None: instrumentation = AIOKafkaInstrumentor() @@ -28,7 +42,7 @@ def test_instrument_api(self) -> None: isinstance(AIOKafkaProducer.send, BoundFunctionWrapper) ) self.assertTrue( - isinstance(AIOKafkaConsumer.__anext__, BoundFunctionWrapper) + isinstance(AIOKafkaConsumer.getone, BoundFunctionWrapper) ) instrumentation.uninstrument() @@ -36,5 +50,271 @@ def test_instrument_api(self) -> None: isinstance(AIOKafkaProducer.send, BoundFunctionWrapper) ) self.assertFalse( - isinstance(AIOKafkaConsumer.__anext__, BoundFunctionWrapper) + isinstance(AIOKafkaConsumer.getone, BoundFunctionWrapper) + ) + + +class TestAIOKafkaInstrumentation(TestBase, IsolatedAsyncioTestCase): + @staticmethod + def consumer_record_factory( + number: int, headers: Tuple[Tuple[str, bytes], ...] + ) -> ConsumerRecord: + return ConsumerRecord( + f"topic_{number}", + number, + number, + number, + number, + f"key_{number}".encode(), + f"value_{number}".encode(), + None, + number, + number, + headers=headers, + ) + + @staticmethod + async def consumer_factory(**consumer_kwargs: Any) -> AIOKafkaConsumer: + consumer = AIOKafkaConsumer(**consumer_kwargs) + + consumer._client.bootstrap = mock.AsyncMock() + consumer._client._wait_on_metadata = mock.AsyncMock() + + await consumer.start() + + consumer._fetcher.next_record = mock.AsyncMock() + + return consumer + + @staticmethod + async def producer_factory() -> AIOKafkaProducer: + producer = AIOKafkaProducer(api_version="1.0") + + producer.client._wait_on_metadata = mock.AsyncMock() + producer.client.bootstrap = mock.AsyncMock() + producer._message_accumulator.add_message = mock.AsyncMock() + producer._sender.start = mock.AsyncMock() + producer._partition = mock.Mock(return_value=1) + + await producer.start() + + return producer + + async def test_getone(self) -> None: + AIOKafkaInstrumentor().uninstrument() + AIOKafkaInstrumentor().instrument(tracer_provider=self.tracer_provider) + + client_id = str(uuid.uuid4()) + group_id = str(uuid.uuid4()) + consumer = await self.consumer_factory( + client_id=client_id, group_id=group_id + ) + next_record_mock: mock.AsyncMock = consumer._fetcher.next_record + + expected_spans = [ + { + "name": "topic_1 receive", + "kind": SpanKind.CONSUMER, + "attributes": { + messaging_attributes.MESSAGING_SYSTEM: messaging_attributes.MessagingSystemValues.KAFKA.value, + server_attributes.SERVER_ADDRESS: '"localhost"', + messaging_attributes.MESSAGING_CLIENT_ID: client_id, + messaging_attributes.MESSAGING_DESTINATION_NAME: "topic_1", + messaging_attributes.MESSAGING_DESTINATION_PARTITION_ID: "1", + messaging_attributes.MESSAGING_KAFKA_MESSAGE_KEY: "key_1", + messaging_attributes.MESSAGING_CONSUMER_GROUP_NAME: group_id, + messaging_attributes.MESSAGING_OPERATION_NAME: "receive", + messaging_attributes.MESSAGING_OPERATION_TYPE: messaging_attributes.MessagingOperationTypeValues.RECEIVE.value, + messaging_attributes.MESSAGING_KAFKA_MESSAGE_OFFSET: 1, + messaging_attributes.MESSAGING_MESSAGE_ID: "topic_1.1.1", + }, + }, + { + "name": "topic_2 receive", + "kind": SpanKind.CONSUMER, + "attributes": { + messaging_attributes.MESSAGING_SYSTEM: messaging_attributes.MessagingSystemValues.KAFKA.value, + server_attributes.SERVER_ADDRESS: '"localhost"', + messaging_attributes.MESSAGING_CLIENT_ID: client_id, + messaging_attributes.MESSAGING_DESTINATION_NAME: "topic_2", + messaging_attributes.MESSAGING_DESTINATION_PARTITION_ID: "2", + messaging_attributes.MESSAGING_KAFKA_MESSAGE_KEY: "key_2", + messaging_attributes.MESSAGING_CONSUMER_GROUP_NAME: group_id, + messaging_attributes.MESSAGING_OPERATION_NAME: "receive", + messaging_attributes.MESSAGING_OPERATION_TYPE: messaging_attributes.MessagingOperationTypeValues.RECEIVE.value, + messaging_attributes.MESSAGING_KAFKA_MESSAGE_OFFSET: 2, + messaging_attributes.MESSAGING_MESSAGE_ID: "topic_2.2.2", + }, + }, + ] + self.memory_exporter.clear() + + next_record_mock.side_effect = [ + self.consumer_record_factory( + 1, + headers=( + ( + "traceparent", + b"00-03afa25236b8cd948fa853d67038ac79-405ff022e8247c46-01", + ), + ), + ), + self.consumer_record_factory(2, headers=()), + ] + + await consumer.getone() + next_record_mock.assert_awaited_with(()) + + first_span = self.memory_exporter.get_finished_spans()[0] + self.assertEqual( + format_trace_id(first_span.get_span_context().trace_id), + "03afa25236b8cd948fa853d67038ac79", + ) + + await consumer.getone() + next_record_mock.assert_awaited_with(()) + + span_list = self.memory_exporter.get_finished_spans() + self._compare_spans(span_list, expected_spans) + + async def test_getone_baggage(self) -> None: + received_baggage = None + + async def async_consume_hook(span, *_) -> None: + nonlocal received_baggage + received_baggage = baggage.get_all(set_span_in_context(span)) + + AIOKafkaInstrumentor().uninstrument() + AIOKafkaInstrumentor().instrument( + tracer_provider=self.tracer_provider, + async_consume_hook=async_consume_hook, + ) + + consumer = await self.consumer_factory() + next_record_mock: mock.AsyncMock = consumer._fetcher.next_record + + self.memory_exporter.clear() + + next_record_mock.side_effect = [ + self.consumer_record_factory( + 1, + headers=( + ( + "traceparent", + b"00-03afa25236b8cd948fa853d67038ac79-405ff022e8247c46-01", + ), + ("baggage", b"foo=bar"), + ), + ), + ] + + await consumer.getone() + next_record_mock.assert_awaited_with(()) + + self.assertEqual(received_baggage, {"foo": "bar"}) + + async def test_getone_consume_hook(self) -> None: + async_consume_hook_mock = mock.AsyncMock() + + AIOKafkaInstrumentor().uninstrument() + AIOKafkaInstrumentor().instrument( + tracer_provider=self.tracer_provider, + async_consume_hook=async_consume_hook_mock, + ) + + consumer = await self.consumer_factory() + next_record_mock: mock.AsyncMock = consumer._fetcher.next_record + + next_record_mock.side_effect = [ + self.consumer_record_factory(1, headers=()) + ] + + await consumer.getone() + + async_consume_hook_mock.assert_awaited_once() + + async def test_send(self) -> None: + AIOKafkaInstrumentor().uninstrument() + AIOKafkaInstrumentor().instrument(tracer_provider=self.tracer_provider) + + producer = await self.producer_factory() + add_message_mock: mock.AsyncMock = ( + producer._message_accumulator.add_message + ) + + tracer = self.tracer_provider.get_tracer(__name__) + with tracer.start_as_current_span("test_span") as span: + await producer.send("topic_1", b"value_1") + + add_message_mock.assert_awaited_with( + TopicPartition(topic="topic_1", partition=1), + None, + b"value_1", + 40.0, + timestamp_ms=None, + headers=[("traceparent", mock.ANY)], ) + add_message_mock.call_args_list[0].kwargs["headers"][0][1].startswith( + f"00-{format_trace_id(span.get_span_context().trace_id)}-".encode() + ) + + await producer.send("topic_2", b"value_2") + add_message_mock.assert_awaited_with( + TopicPartition(topic="topic_2", partition=1), + None, + b"value_2", + 40.0, + timestamp_ms=None, + headers=[("traceparent", mock.ANY)], + ) + + async def test_send_baggage(self) -> None: + AIOKafkaInstrumentor().uninstrument() + AIOKafkaInstrumentor().instrument(tracer_provider=self.tracer_provider) + + producer = await self.producer_factory() + add_message_mock: mock.AsyncMock = ( + producer._message_accumulator.add_message + ) + + tracer = self.tracer_provider.get_tracer(__name__) + ctx = baggage.set_baggage("foo", "bar") + context.attach(ctx) + + with tracer.start_as_current_span("test_span", context=ctx): + await producer.send("topic_1", b"value_1") + + add_message_mock.assert_awaited_with( + TopicPartition(topic="topic_1", partition=1), + None, + b"value_1", + 40.0, + timestamp_ms=None, + headers=[("traceparent", mock.ANY), ("baggage", b"foo=bar")], + ) + + async def test_send_produce_hook(self) -> None: + async_produce_hook_mock = mock.AsyncMock() + + AIOKafkaInstrumentor().uninstrument() + AIOKafkaInstrumentor().instrument( + tracer_provider=self.tracer_provider, + async_produce_hook=async_produce_hook_mock, + ) + + producer = await self.producer_factory() + + await producer.send("topic_1", b"value_1") + + async_produce_hook_mock.assert_awaited_once() + + def _compare_spans( + self, spans: Sequence[ReadableSpan], expected_spans: List[dict] + ) -> None: + self.assertEqual(len(spans), len(expected_spans)) + for span, expected_span in zip(spans, expected_spans): + self.assertEqual(expected_span["name"], span.name) + self.assertEqual(expected_span["kind"], span.kind) + self.assertEqual( + expected_span["attributes"], dict(span.attributes) + ) diff --git a/instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_utils.py b/instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_utils.py index b1b2792608..09a8655309 100644 --- a/instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_utils.py +++ b/instrumentation/opentelemetry-instrumentation-aiokafka/tests/test_utils.py @@ -23,7 +23,7 @@ _create_consumer_span, _extract_send_partition, _get_span_name, - _wrap_anext, + _wrap_getone, _wrap_send, ) from opentelemetry.trace import SpanKind @@ -187,7 +187,7 @@ async def test_wrap_next( original_next_callback = mock.AsyncMock() kafka_consumer = mock.MagicMock() - wrapped_next = _wrap_anext(tracer, consume_hook) + wrapped_next = _wrap_getone(tracer, consume_hook) record = await wrapped_next( original_next_callback, kafka_consumer, self.args, self.kwargs ) diff --git a/tox.ini b/tox.ini index e0a5a71131..2b0995d8fc 100644 --- a/tox.ini +++ b/tox.ini @@ -444,6 +444,7 @@ commands_pre = aiokafka: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api aiokafka: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions aiokafka: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk + aiokafka: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils aiokafka: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aiokafka/test-requirements.txt kafka-python: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api