mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 20:52:57 +08:00
Add uninstrument test for starlette (#1558)
This commit is contained in:
@ -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):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user