Skip to content

Commit

Permalink
Audit and test opentelemetry-instrumentation-fastapi NoOpTracerProvid…
Browse files Browse the repository at this point in the history
…er (#2779)
  • Loading branch information
qiuge615 authored Aug 7, 2024
1 parent 009bdba commit fc1c8f0
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,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 fc1c8f0

Please sign in to comment.