From 048b0b612f5dbf73702c9afe76cb8ebd3db85090 Mon Sep 17 00:00:00 2001 From: Adi Kochavi Date: Mon, 30 Jan 2023 15:55:48 +0200 Subject: [PATCH 1/3] Audit and test opentelemetry-instrumentation-aiohttp-client NoOpTracerProvider --- .../tests/test_aiohttp_client_integration.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index 524b93faeb..ba6ae05fd3 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -26,6 +26,7 @@ from pkg_resources import iter_entry_points from opentelemetry import context +from opentelemetry import trace as trace_api from opentelemetry.instrumentation import aiohttp_client from opentelemetry.instrumentation.aiohttp_client import ( AioHttpClientInstrumentor, @@ -434,6 +435,17 @@ async def create_session(server: aiohttp.test_utils.TestServer): run_with_test_server(create_session, self.URL, self.default_handler) self.assert_spans(1) + def test_no_op_tracer_provider(self): + AioHttpClientInstrumentor().uninstrument() + AioHttpClientInstrumentor().instrument(tracer_provider=trace_api.NoOpTracerProvider()) + + host, port = run_with_test_server( + self.get_default_request(), self.URL, self.default_handler + ) + spans_list = self.memory_exporter.get_finished_spans() + self.assertEqual(len(spans_list), 0) + + def test_uninstrument(self): AioHttpClientInstrumentor().uninstrument() run_with_test_server( From da8b9fb3d50e3af8fa45070c149cb76b841474a1 Mon Sep 17 00:00:00 2001 From: Adi Kochavi Date: Sun, 5 Feb 2023 09:13:21 +0200 Subject: [PATCH 2/3] wip --- .../tests/test_aiohttp_client_integration.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index ba6ae05fd3..ca6e6da460 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -437,7 +437,9 @@ async def create_session(server: aiohttp.test_utils.TestServer): def test_no_op_tracer_provider(self): AioHttpClientInstrumentor().uninstrument() - AioHttpClientInstrumentor().instrument(tracer_provider=trace_api.NoOpTracerProvider()) + AioHttpClientInstrumentor().instrument( + tracer_provider=trace_api.NoOpTracerProvider() + ) host, port = run_with_test_server( self.get_default_request(), self.URL, self.default_handler @@ -445,7 +447,6 @@ def test_no_op_tracer_provider(self): spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 0) - def test_uninstrument(self): AioHttpClientInstrumentor().uninstrument() run_with_test_server( From b554e22bcc1d33a54a2c1b5b2932fbe659465aab Mon Sep 17 00:00:00 2001 From: Adi Kochavi Date: Sun, 5 Feb 2023 12:27:30 +0200 Subject: [PATCH 3/3] wip --- .../tests/test_aiohttp_client_integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index ca6e6da460..9210dae702 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -441,7 +441,7 @@ def test_no_op_tracer_provider(self): tracer_provider=trace_api.NoOpTracerProvider() ) - host, port = run_with_test_server( + run_with_test_server( self.get_default_request(), self.URL, self.default_handler ) spans_list = self.memory_exporter.get_finished_spans()