Skip to content

Commit

Permalink
Add NoOpTracerProvider test for starlette
Browse files Browse the repository at this point in the history
  • Loading branch information
mspillane committed Jun 7, 2024
1 parent 5b84128 commit 6ab7c3b
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,21 @@ def test_uninstrument(self):
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 0)

def test_no_op_tracer_provider(self):
self._client.get("/foobar")
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 3)

self.memory_exporter.clear()
self._instrumentor.uninstrument()

tracer_provider = NoOpTracerProvider()
self._instrumentor.instrument(tracer_provider=tracer_provider)

self._client.get("/foobar")
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 0)


class TestAutoInstrumentationHooks(TestStarletteManualInstrumentationHooks):
"""
Expand Down

0 comments on commit 6ab7c3b

Please sign in to comment.