Skip to content

Commit 0a4b3b4

Browse files
authored
Audit and test opentelemetry-instrumentation-aiohttp-client NoOpTrace… (#1612)
1 parent 260df4d commit 0a4b3b4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from pkg_resources import iter_entry_points
2727

2828
from opentelemetry import context
29+
from opentelemetry import trace as trace_api
2930
from opentelemetry.instrumentation import aiohttp_client
3031
from opentelemetry.instrumentation.aiohttp_client import (
3132
AioHttpClientInstrumentor,
@@ -434,6 +435,18 @@ async def create_session(server: aiohttp.test_utils.TestServer):
434435
run_with_test_server(create_session, self.URL, self.default_handler)
435436
self.assert_spans(1)
436437

438+
def test_no_op_tracer_provider(self):
439+
AioHttpClientInstrumentor().uninstrument()
440+
AioHttpClientInstrumentor().instrument(
441+
tracer_provider=trace_api.NoOpTracerProvider()
442+
)
443+
444+
run_with_test_server(
445+
self.get_default_request(), self.URL, self.default_handler
446+
)
447+
spans_list = self.memory_exporter.get_finished_spans()
448+
self.assertEqual(len(spans_list), 0)
449+
437450
def test_uninstrument(self):
438451
AioHttpClientInstrumentor().uninstrument()
439452
run_with_test_server(

0 commit comments

Comments
 (0)