File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
instrumentation/opentelemetry-instrumentation-httpx/tests Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1292,6 +1292,26 @@ def test_basic_multiple(self):
12921292 self .perform_request (self .URL , client = self .client2 )
12931293 self .assert_span (num_spans = 2 )
12941294
1295+ async def test_no_op_tracer_provider (self ):
1296+ HTTPXClientInstrumentor ().uninstrument ()
1297+ HTTPXClientInstrumentor ().instrument (
1298+ tracer_provider = trace .NoOpTracerProvider ()
1299+ )
1300+ async with httpx .AsyncClient () as client :
1301+ await client .get ("http://test.com" )
1302+ spans = self .memory_exporter .get_finished_spans ()
1303+ self .assertEqual (len (spans ), 0 )
1304+
1305+ def test_no_op_tracer_provider_sync (self ):
1306+ HTTPXClientInstrumentor ().uninstrument ()
1307+ HTTPXClientInstrumentor ().instrument (
1308+ tracer_provider = trace .NoOpTracerProvider ()
1309+ )
1310+ with httpx .Client () as client :
1311+ client .get ("http://test.com" )
1312+ spans = self .memory_exporter .get_finished_spans ()
1313+ self .assertEqual (len (spans ), 0 )
1314+
12951315 def test_async_response_hook_does_nothing_if_not_coroutine (self ):
12961316 HTTPXClientInstrumentor ().instrument (
12971317 tracer_provider = self .tracer_provider ,
You can’t perform that action at this time.
0 commit comments