File tree 1 file changed +12
-0
lines changed
instrumentation/opentelemetry-instrumentation-httpx/tests
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 34
34
from opentelemetry .test .mock_textmap import MockTextMapPropagator
35
35
from opentelemetry .test .test_base import TestBase
36
36
from opentelemetry .trace import StatusCode
37
+ from opentelemetry import trace as trace_api
37
38
38
39
if typing .TYPE_CHECKING :
39
40
from opentelemetry .instrumentation .httpx import (
@@ -763,3 +764,14 @@ def test_basic_multiple(self):
763
764
self .perform_request (self .URL , client = self .client )
764
765
self .perform_request (self .URL , client = self .client2 )
765
766
self .assert_span (num_spans = 2 )
767
+
768
+ def test_no_op_tracer_provider (self ):
769
+ HTTPXClientInstrumentor ().uninstrument ()
770
+ HTTPXClientInstrumentor ().instrument (
771
+ tracer_provider = trace_api .NoOpTracerProvider ()
772
+ )
773
+ async with httpx .AsyncClient () as client :
774
+ await client .get ('http://test.com' )
775
+
776
+ spans = self .memory_exporter .get_finished_spans ()
777
+ self .assertEqual (len (spans ), 0 )
You can’t perform that action at this time.
0 commit comments