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 )
@@ -320,8 +320,8 @@ def test_schema_no_metrics(service, namespace):
320
320
321
321
322
322
def 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 )]
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
@@ -332,9 +332,9 @@ def test_exceed_number_of_dimensions(metric, namespace):
332
332
333
333
334
334
def 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)
336
336
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 )]
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