88from aws_lambda_powertools import Metrics , single_metric
99from aws_lambda_powertools .metrics import MetricUnit , MetricUnitError , MetricValueError , SchemaValidationError
1010from aws_lambda_powertools .metrics import metrics as metrics_global
11- from aws_lambda_powertools .metrics .base import MetricManager
11+ from aws_lambda_powertools .metrics .base import MAX_DIMENSIONS , MetricManager
1212
1313
1414@pytest .fixture (scope = "function" , autouse = True )
@@ -320,8 +320,8 @@ def test_schema_no_metrics(service, namespace):
320320
321321
322322def test_exceed_number_of_dimensions (metric , namespace ):
323- # GIVEN we have more dimensions than CloudWatch supports
324- dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (11 )]
323+ # GIVEN we have more dimensions than CloudWatch supports (N+1)
324+ dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (MAX_DIMENSIONS + 1 )]
325325
326326 # WHEN we attempt to serialize them into a valid EMF object
327327 # THEN it should fail validation and raise SchemaValidationError
@@ -332,9 +332,9 @@ def test_exceed_number_of_dimensions(metric, namespace):
332332
333333
334334def test_exceed_number_of_dimensions_with_service (metric , namespace , monkeypatch ):
335- # GIVEN we have service set and add more dimensions than CloudWatch supports (N+ 1)
335+ # GIVEN we have service set and add more dimensions than CloudWatch supports (N- 1)
336336 monkeypatch .setenv ("POWERTOOLS_SERVICE_NAME" , "test_service" )
337- dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (9 )]
337+ dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (MAX_DIMENSIONS )]
338338
339339 # WHEN we attempt to serialize them into a valid EMF object
340340 # THEN it should fail validation and raise SchemaValidationError
0 commit comments