diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/aws-cdk-cloudwatch-metric-dimensions.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/aws-cdk-cloudwatch-metric-dimensions.assets.json new file mode 100644 index 0000000000000..16284e1e5e694 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/aws-cdk-cloudwatch-metric-dimensions.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "5b7b9376300e8d5da09834e7dfc97bf825e9354f770b53e1bc3e3d0a9de8f10c": { + "source": { + "path": "aws-cdk-cloudwatch-metric-dimensions.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "5b7b9376300e8d5da09834e7dfc97bf825e9354f770b53e1bc3e3d0a9de8f10c.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/aws-cdk-cloudwatch-metric-dimensions.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/aws-cdk-cloudwatch-metric-dimensions.template.json new file mode 100644 index 0000000000000..54d0bd59f3349 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/aws-cdk-cloudwatch-metric-dimensions.template.json @@ -0,0 +1,105 @@ +{ + "Resources": { + "queue": { + "Type": "AWS::SQS::Queue" + }, + "Alarm7103F465": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "DatapointsToAlarm": 2, + "Dimensions": [ + { + "Name": "BlankD1", + "Value": "value1" + }, + { + "Name": "BlankD10", + "Value": "value10" + }, + { + "Name": "BlankD2", + "Value": "value2" + }, + { + "Name": "BlankD3", + "Value": "value3" + }, + { + "Name": "BlankD4", + "Value": "value4" + }, + { + "Name": "BlankD5", + "Value": "value5" + }, + { + "Name": "BlankD6", + "Value": "value6" + }, + { + "Name": "BlankD7", + "Value": "value7" + }, + { + "Name": "BlankD8", + "Value": "value8" + }, + { + "Name": "BlankD9", + "Value": "value9" + }, + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "queue", + "QueueName" + ] + } + } + ], + "EvaluationPeriods": 3, + "MetricName": "ApproximateNumberOfMessagesVisible", + "Namespace": "AWS/SQS", + "Period": 300, + "Statistic": "Average", + "Threshold": 100 + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/integ.json new file mode 100644 index 0000000000000..b3f4a8a62b0cf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "metric-with-dimensions-test/DefaultTest": { + "stacks": [ + "aws-cdk-cloudwatch-metric-dimensions" + ], + "assertionStack": "metric-with-dimensions-test/DefaultTest/DeployAssert", + "assertionStackName": "metricwithdimensionstestDefaultTestDeployAssert1196DF0F" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/manifest.json new file mode 100644 index 0000000000000..31a9dc49d6c44 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/manifest.json @@ -0,0 +1,119 @@ +{ + "version": "36.0.0", + "artifacts": { + "aws-cdk-cloudwatch-metric-dimensions.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-cloudwatch-metric-dimensions.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-cloudwatch-metric-dimensions": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-cloudwatch-metric-dimensions.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/5b7b9376300e8d5da09834e7dfc97bf825e9354f770b53e1bc3e3d0a9de8f10c.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-cloudwatch-metric-dimensions.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-cloudwatch-metric-dimensions.assets" + ], + "metadata": { + "/aws-cdk-cloudwatch-metric-dimensions/queue": [ + { + "type": "aws:cdk:logicalId", + "data": "queue" + } + ], + "/aws-cdk-cloudwatch-metric-dimensions/Alarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Alarm7103F465" + } + ], + "/aws-cdk-cloudwatch-metric-dimensions/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-cloudwatch-metric-dimensions/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-cloudwatch-metric-dimensions" + }, + "metricwithdimensionstestDefaultTestDeployAssert1196DF0F.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "metricwithdimensionstestDefaultTestDeployAssert1196DF0F.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "metricwithdimensionstestDefaultTestDeployAssert1196DF0F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "metricwithdimensionstestDefaultTestDeployAssert1196DF0F.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "metricwithdimensionstestDefaultTestDeployAssert1196DF0F.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "metricwithdimensionstestDefaultTestDeployAssert1196DF0F.assets" + ], + "metadata": { + "/metric-with-dimensions-test/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/metric-with-dimensions-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "metric-with-dimensions-test/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/metricwithdimensionstestDefaultTestDeployAssert1196DF0F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/metricwithdimensionstestDefaultTestDeployAssert1196DF0F.assets.json new file mode 100644 index 0000000000000..c673635d60504 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/metricwithdimensionstestDefaultTestDeployAssert1196DF0F.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "metricwithdimensionstestDefaultTestDeployAssert1196DF0F.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/metricwithdimensionstestDefaultTestDeployAssert1196DF0F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/metricwithdimensionstestDefaultTestDeployAssert1196DF0F.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/metricwithdimensionstestDefaultTestDeployAssert1196DF0F.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/tree.json new file mode 100644 index 0000000000000..f48626e919d06 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.js.snapshot/tree.json @@ -0,0 +1,191 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-cloudwatch-metric-dimensions": { + "id": "aws-cdk-cloudwatch-metric-dimensions", + "path": "aws-cdk-cloudwatch-metric-dimensions", + "children": { + "queue": { + "id": "queue", + "path": "aws-cdk-cloudwatch-metric-dimensions/queue", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Alarm": { + "id": "Alarm", + "path": "aws-cdk-cloudwatch-metric-dimensions/Alarm", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-cloudwatch-metric-dimensions/Alarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "datapointsToAlarm": 2, + "dimensions": [ + { + "name": "BlankD1", + "value": "value1" + }, + { + "name": "BlankD10", + "value": "value10" + }, + { + "name": "BlankD2", + "value": "value2" + }, + { + "name": "BlankD3", + "value": "value3" + }, + { + "name": "BlankD4", + "value": "value4" + }, + { + "name": "BlankD5", + "value": "value5" + }, + { + "name": "BlankD6", + "value": "value6" + }, + { + "name": "BlankD7", + "value": "value7" + }, + { + "name": "BlankD8", + "value": "value8" + }, + { + "name": "BlankD9", + "value": "value9" + }, + { + "name": "QueueName", + "value": { + "Fn::GetAtt": [ + "queue", + "QueueName" + ] + } + } + ], + "evaluationPeriods": 3, + "metricName": "ApproximateNumberOfMessagesVisible", + "namespace": "AWS/SQS", + "period": 300, + "statistic": "Average", + "threshold": 100 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-cloudwatch-metric-dimensions/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-cloudwatch-metric-dimensions/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "metric-with-dimensions-test": { + "id": "metric-with-dimensions-test", + "path": "metric-with-dimensions-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "metric-with-dimensions-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "metric-with-dimensions-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "metric-with-dimensions-test/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "metric-with-dimensions-test/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "metric-with-dimensions-test/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.ts new file mode 100644 index 0000000000000..204d876e989b7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.metric-with-dimensions.ts @@ -0,0 +1,39 @@ +// Creates an Alarm with a Metric that contains 11 dimensions +// 1 valid dimension used, with 10 blank ones since it's hard to find a resource with more than 5 dimensions that is feasable to run tests with +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-cloudwatch-metric-dimensions'); + +const queue = new cdk.CfnResource(stack, 'queue', { type: 'AWS::SQS::Queue' }); + +const numberOfMessagesVisibleMetric = new cloudwatch.Metric({ + namespace: 'AWS/SQS', + metricName: 'ApproximateNumberOfMessagesVisible', + dimensionsMap: { + QueueName: queue.getAtt('QueueName').toString(), + BlankD1: 'value1', + BlankD2: 'value2', + BlankD3: 'value3', + BlankD4: 'value4', + BlankD5: 'value5', + BlankD6: 'value6', + BlankD7: 'value7', + BlankD8: 'value8', + BlankD9: 'value9', + BlankD10: 'value10', + }, +}); + +numberOfMessagesVisibleMetric.createAlarm(stack, 'Alarm', { + threshold: 100, + evaluationPeriods: 3, + datapointsToAlarm: 2, +}); + +new IntegTest(app, 'metric-with-dimensions-test', { + testCases: [stack], +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts index 99f7a27bc138c..8b6c05bc45122 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts @@ -509,8 +509,8 @@ export class Metric implements IMetric { } var dimsArray = Object.keys(dims); - if (dimsArray?.length > 10) { - throw new Error(`The maximum number of dimensions is 10, received ${dimsArray.length}`); + if (dimsArray?.length > 30) { + throw new Error(`The maximum number of dimensions is 30, received ${dimsArray.length}`); } dimsArray.map(key => { diff --git a/packages/aws-cdk-lib/aws-cloudwatch/test/metrics.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/metrics.test.ts index ac0d0186ea014..42f3bd14a1fbb 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/test/metrics.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/metrics.test.ts @@ -112,7 +112,7 @@ describe('Metrics', () => { }); - testDeprecated('throws error when there are more than 10 dimensions', () => { + testDeprecated('throws error when there are more than 30 dimensions', () => { expect(() => { new Metric({ namespace: 'Test', @@ -130,13 +130,33 @@ describe('Metrics', () => { dimensionI: 'value9', dimensionJ: 'value10', dimensionK: 'value11', + dimensionL: 'value12', + dimensionM: 'value13', + dimensionN: 'value14', + dimensionO: 'value15', + dimensionP: 'value16', + dimensionQ: 'value17', + dimensionR: 'value18', + dimensionS: 'value19', + dimensionT: 'value20', + dimensionU: 'value21', + dimensionV: 'value22', + dimensionW: 'value23', + dimensionX: 'value24', + dimensionY: 'value25', + dimensionZ: 'value26', + dimensionAA: 'value27', + dimensionAB: 'value28', + dimensionAC: 'value29', + dimensionAD: 'value30', + dimensionAE: 'value31', }, } ); - }).toThrow(/The maximum number of dimensions is 10, received 11/); + }).toThrow(/The maximum number of dimensions is 30, received 31/); }); - test('throws error when there are more than 10 dimensions in dimensionsMap', () => { + test('throws error when there are more than 30 dimensions in dimensionsMap', () => { expect(() => { new Metric({ namespace: 'Test', @@ -154,9 +174,29 @@ describe('Metrics', () => { dimensionI: 'value9', dimensionJ: 'value10', dimensionK: 'value11', + dimensionL: 'value12', + dimensionM: 'value13', + dimensionN: 'value14', + dimensionO: 'value15', + dimensionP: 'value16', + dimensionQ: 'value17', + dimensionR: 'value18', + dimensionS: 'value19', + dimensionT: 'value20', + dimensionU: 'value21', + dimensionV: 'value22', + dimensionW: 'value23', + dimensionX: 'value24', + dimensionY: 'value25', + dimensionZ: 'value26', + dimensionAA: 'value27', + dimensionAB: 'value28', + dimensionAC: 'value29', + dimensionAD: 'value30', + dimensionAE: 'value31', }, } ); - }).toThrow(/The maximum number of dimensions is 10, received 11/); + }).toThrow(/The maximum number of dimensions is 30, received 31/); });