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 56
56
from opentelemetry .test .mock_textmap import MockTextMapPropagator
57
57
from opentelemetry .test .test_base import TestBase
58
58
from opentelemetry .trace import StatusCode
59
+ from opentelemetry import trace as trace_api
59
60
60
61
if typing .TYPE_CHECKING :
61
62
from opentelemetry .instrumentation .httpx import (
@@ -1214,3 +1215,14 @@ def test_basic_multiple(self):
1214
1215
self .perform_request (self .URL , client = self .client )
1215
1216
self .perform_request (self .URL , client = self .client2 )
1216
1217
self .assert_span (num_spans = 2 )
1218
+
1219
+ def test_no_op_tracer_provider (self ):
1220
+ HTTPXClientInstrumentor ().uninstrument ()
1221
+ HTTPXClientInstrumentor ().instrument (
1222
+ tracer_provider = trace_api .NoOpTracerProvider ()
1223
+ )
1224
+ async with httpx .AsyncClient () as client :
1225
+ await client .get ('http://test.com' )
1226
+
1227
+ spans = self .memory_exporter .get_finished_spans ()
1228
+ self .assertEqual (len (spans ), 0 )
You can’t perform that action at this time.
0 commit comments