Skip to content

Commit fc1c8f0

Browse files
authored
Audit and test opentelemetry-instrumentation-fastapi NoOpTracerProvider (#2779)
1 parent 009bdba commit fc1c8f0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py

+12
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,18 @@ def test_uninstrument_after_instrument(self):
10691069
spans = self.memory_exporter.get_finished_spans()
10701070
self.assertEqual(len(spans), 3)
10711071

1072+
def test_no_op_tracer_provider(self):
1073+
self._instrumentor.uninstrument()
1074+
self._instrumentor.instrument(
1075+
tracer_provider=trace.NoOpTracerProvider()
1076+
)
1077+
1078+
app = self._create_fastapi_app()
1079+
client = TestClient(app)
1080+
client.get("/foobar")
1081+
spans = self.memory_exporter.get_finished_spans()
1082+
self.assertEqual(len(spans), 0)
1083+
10721084
def tearDown(self):
10731085
self._instrumentor.uninstrument()
10741086
super().tearDown()

0 commit comments

Comments
 (0)