@@ -33,7 +33,7 @@ def setUp(self):
3333 self .addCleanup (patcher .stop )
3434
3535 patcher = patch ("datadog_lambda.metric.lambda_metric" )
36- self .mock_wrapper_lambda_metric = patcher .start ()
36+ self .mock_lambda_metric = patcher .start ()
3737 self .addCleanup (patcher .stop )
3838
3939 patcher = patch ("datadog_lambda.wrapper.extract_dd_trace_context" )
@@ -57,6 +57,11 @@ def setUp(self):
5757 self .mock_is_cold_start .return_value = True
5858 self .addCleanup (patcher .stop )
5959
60+ patcher = patch ("datadog_lambda.tags.python_version_tuple" )
61+ self .mock_python_version_tuple = patcher .start ()
62+ self .mock_python_version_tuple .return_value = ("2" , "7" , "10" )
63+ self .addCleanup (patcher .stop )
64+
6065 def test_datadog_lambda_wrapper (self ):
6166 @datadog_lambda_wrapper
6267 def lambda_handler (event , context ):
@@ -116,7 +121,7 @@ def lambda_handler(event, context):
116121
117122 lambda_handler (lambda_event , get_mock_context ())
118123
119- self .mock_wrapper_lambda_metric .assert_has_calls (
124+ self .mock_lambda_metric .assert_has_calls (
120125 [
121126 call (
122127 "aws.lambda.enhanced.invocations" ,
@@ -126,6 +131,8 @@ def lambda_handler(event, context):
126131 "account_id:123457598159" ,
127132 "functionname:python-layer-test" ,
128133 "cold_start:true" ,
134+ "memorysize:256" ,
135+ "runtime:python2.7" ,
129136 ],
130137 )
131138 ]
@@ -145,7 +152,7 @@ def lambda_handler(event, context):
145152 with self .assertRaises (RuntimeError ):
146153 lambda_handler (lambda_event , get_mock_context ())
147154
148- self .mock_wrapper_lambda_metric .assert_has_calls (
155+ self .mock_lambda_metric .assert_has_calls (
149156 [
150157 call (
151158 "aws.lambda.enhanced.invocations" ,
@@ -155,6 +162,8 @@ def lambda_handler(event, context):
155162 "account_id:123457598159" ,
156163 "functionname:python-layer-test" ,
157164 "cold_start:true" ,
165+ "memorysize:256" ,
166+ "runtime:python2.7" ,
158167 ],
159168 ),
160169 call (
@@ -165,6 +174,8 @@ def lambda_handler(event, context):
165174 "account_id:123457598159" ,
166175 "functionname:python-layer-test" ,
167176 "cold_start:true" ,
177+ "memorysize:256" ,
178+ "runtime:python2.7" ,
168179 ],
169180 ),
170181 ]
@@ -189,7 +200,7 @@ def lambda_handler(event, context):
189200 lambda_event , get_mock_context (aws_request_id = "second-request-id" )
190201 )
191202
192- self .mock_wrapper_lambda_metric .assert_has_calls (
203+ self .mock_lambda_metric .assert_has_calls (
193204 [
194205 call (
195206 "aws.lambda.enhanced.invocations" ,
@@ -199,6 +210,8 @@ def lambda_handler(event, context):
199210 "account_id:123457598159" ,
200211 "functionname:python-layer-test" ,
201212 "cold_start:true" ,
213+ "memorysize:256" ,
214+ "runtime:python2.7" ,
202215 ],
203216 ),
204217 call (
@@ -209,6 +222,8 @@ def lambda_handler(event, context):
209222 "account_id:123457598159" ,
210223 "functionname:python-layer-test" ,
211224 "cold_start:false" ,
225+ "memorysize:256" ,
226+ "runtime:python2.7" ,
212227 ],
213228 ),
214229 ]
@@ -226,5 +241,5 @@ def lambda_handler(event, context):
226241 with self .assertRaises (RuntimeError ):
227242 lambda_handler (lambda_event , get_mock_context ())
228243
229- self .mock_wrapper_lambda_metric .assert_not_called ()
244+ self .mock_lambda_metric .assert_not_called ()
230245
0 commit comments