8
8
from aws_lambda_powertools import Metrics , single_metric
9
9
from aws_lambda_powertools .metrics import MetricUnit , MetricUnitError , MetricValueError , SchemaValidationError
10
10
from 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
12
12
13
13
14
14
@pytest .fixture (scope = "function" , autouse = True )
@@ -321,7 +321,7 @@ def test_schema_no_metrics(service, namespace):
321
321
322
322
def test_exceed_number_of_dimensions (metric , namespace ):
323
323
# GIVEN we have more dimensions than CloudWatch supports (N+1)
324
- dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (31 )]
324
+ dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (MAX_DIMENSIONS + 2 )]
325
325
326
326
# WHEN we attempt to serialize them into a valid EMF object
327
327
# THEN it should fail validation and raise SchemaValidationError
@@ -334,7 +334,7 @@ def test_exceed_number_of_dimensions(metric, namespace):
334
334
def test_exceed_number_of_dimensions_with_service (metric , namespace , monkeypatch ):
335
335
# GIVEN we have service set and add more dimensions than CloudWatch supports (N-1)
336
336
monkeypatch .setenv ("POWERTOOLS_SERVICE_NAME" , "test_service" )
337
- dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (29 )]
337
+ dimensions = [{"name" : f"test_{ i } " , "value" : "test" } for i in range (MAX_DIMENSIONS )]
338
338
339
339
# WHEN we attempt to serialize them into a valid EMF object
340
340
# THEN it should fail validation and raise SchemaValidationError
0 commit comments