Add uninstrument test for aws lambda (#1505)

This commit is contained in:
Shalev Roda
2022-12-19 23:45:43 +02:00
committed by GitHub
parent 23f63a5328
commit a9f34136d2

View File

@ -379,3 +379,18 @@ class TestAwsLambdaInstrumentor(TestBase):
SpanAttributes.HTTP_USER_AGENT: "agent",
},
)
def test_uninstrument(self):
AwsLambdaInstrumentor().instrument()
mock_execute_lambda(MOCK_LAMBDA_API_GATEWAY_HTTP_API_EVENT)
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 1)
self.memory_exporter.clear()
AwsLambdaInstrumentor().uninstrument()
mock_execute_lambda(MOCK_LAMBDA_API_GATEWAY_HTTP_API_EVENT)
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 0)