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