Add uninstrument test for starlette (#1558)

This commit is contained in:
Shalev Roda
2023-01-06 19:04:49 +02:00
committed by GitHub
parent c1206d9c08
commit a97326d871

View File

@ -320,6 +320,18 @@ class TestAutoInstrumentation(TestStarletteManualInstrumentation):
self.assertEqual(span.resource.attributes["key1"], "value1")
self.assertEqual(span.resource.attributes["key2"], "value2")
def test_uninstrument(self):
self._client.get("/foobar")
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 3)
self.memory_exporter.clear()
self._instrumentor.uninstrument()
self._client.get("/foobar")
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 0)
class TestAutoInstrumentationHooks(TestStarletteManualInstrumentationHooks):
"""