Skip to content

Commit

Permalink
Audit and test opentelemetry-instrumentation-fastapi NoOpTracerProvider
Browse files Browse the repository at this point in the history
Signed-off-by: Qiu, David <[email protected]>
  • Loading branch information
qiuge615 committed May 28, 2024
1 parent eb8e456 commit 4aaadf8
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,18 @@ def test_uninstrument_after_instrument(self):
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 3)

def test_no_op_tracer_provider(self):
self._instrumentor.uninstrument()
self._instrumentor.instrument(
tracer_provider=trace.NoOpTracerProvider()
)

app = self._create_fastapi_app()
client = TestClient(app)
client.get("/foobar")
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 0)

def tearDown(self):
self._instrumentor.uninstrument()
super().tearDown()
Expand Down

0 comments on commit 4aaadf8

Please sign in to comment.