From c21caf56c0aa4c3b5162b899f67b5622430f4107 Mon Sep 17 00:00:00 2001 From: Eugene Cheung Date: Fri, 8 Nov 2024 11:35:12 -0500 Subject: [PATCH] fix(MetricFactory): wrap search query dimensions with quotes to handle potential whitespace --- lib/common/metric/MetricFactory.ts | 9 ++++++--- .../__snapshots__/MetricFactory.test.ts.snap | 18 +++++++++--------- .../MonitoringAspect.test.ts.snap | 16 ++++++++-------- .../MonitoringFacade.test.ts.snap | 4 ++-- .../DynamoTableMonitoring.test.ts.snap | 8 ++++---- .../__snapshots__/EC2Monitoring.test.ts.snap | 14 +++++++------- .../CustomMonitoring.test.ts.snap | 4 ++-- 7 files changed, 38 insertions(+), 35 deletions(-) diff --git a/lib/common/metric/MetricFactory.ts b/lib/common/metric/MetricFactory.ts index 2df872e7..6531784e 100644 --- a/lib/common/metric/MetricFactory.ts +++ b/lib/common/metric/MetricFactory.ts @@ -150,16 +150,19 @@ export class MetricFactory { const finalPeriod = period ?? this.globalDefaults.period ?? DefaultMetricPeriod; const searchNamespace = this.getNamespaceWithFallback(namespace); + const keysWithQuotations = Object.keys(dimensionsMap).map( + (key) => `"${key}"`, + ); const namespacePlusDimensionKeys = [ - searchNamespace, - ...Object.keys(dimensionsMap), + `"${searchNamespace}"`, + ...keysWithQuotations, ].join(","); const metricSchema = `{${namespacePlusDimensionKeys}}`; const dimensionKeysAndValues = Object.entries( this.removeUndefinedEntries(dimensionsMap), ) - .map(([key, value]) => `${key}="${value}"`) + .map(([key, value]) => `"${key}"="${value}"`) .join(" "); const expression = `SEARCH('${metricSchema} ${dimensionKeysAndValues} ${query}', '${statistic}', ${finalPeriod.toSeconds()})`; diff --git a/test/common/metric/__snapshots__/MetricFactory.test.ts.snap b/test/common/metric/__snapshots__/MetricFactory.test.ts.snap index ca773302..5049afcf 100644 --- a/test/common/metric/__snapshots__/MetricFactory.test.ts.snap +++ b/test/common/metric/__snapshots__/MetricFactory.test.ts.snap @@ -314,7 +314,7 @@ MathExpression { exports[`snapshot test: createMetricSearch 1`] = ` MathExpression { "color": undefined, - "expression": "SEARCH('{DummyNamespace,DummyDimension} DummyDimension=\\"DummyDimensionValue\\" MyMetricPrefix-', 'Sum', 300)", + "expression": "SEARCH('{\\"DummyNamespace\\",\\"DummyDimension\\"} \\"DummyDimension\\"=\\"DummyDimensionValue\\" MyMetricPrefix-', 'Sum', 300)", "label": " ", "period": Duration { "amount": 5, @@ -333,7 +333,7 @@ MathExpression { exports[`snapshot test: createMetricSearch 2`] = ` MathExpression { "color": undefined, - "expression": "SEARCH('{DummyNamespaceOverride,DummyDimension} DummyDimension=\\"DummyDimensionValue\\" MyMetricPrefix-', 'Sum', 300)", + "expression": "SEARCH('{\\"DummyNamespaceOverride\\",\\"DummyDimension\\"} \\"DummyDimension\\"=\\"DummyDimensionValue\\" MyMetricPrefix-', 'Sum', 300)", "label": " ", "period": Duration { "amount": 5, @@ -352,7 +352,7 @@ MathExpression { exports[`snapshot test: createMetricSearch 3`] = ` MathExpression { "color": undefined, - "expression": "SEARCH('{DummyNamespaceOverride,DummyUndefinedDimension,DummyDefinedDimension} DummyDefinedDimension=\\"DummyDimensionValue\\" MyMetricPrefix-', 'Sum', 300)", + "expression": "SEARCH('{\\"DummyNamespaceOverride\\",\\"DummyUndefinedDimension\\",\\"DummyDefinedDimension\\"} \\"DummyDefinedDimension\\"=\\"DummyDimensionValue\\" MyMetricPrefix-', 'Sum', 300)", "label": " ", "period": Duration { "amount": 5, @@ -371,7 +371,7 @@ MathExpression { exports[`snapshot test: createMetricSearch 4`] = ` MathExpression { "color": undefined, - "expression": "SEARCH('{DummyNamespaceOverride} MyMetricPrefix-', 'Sum', 300)", + "expression": "SEARCH('{\\"DummyNamespaceOverride\\"} MyMetricPrefix-', 'Sum', 300)", "label": " ", "period": Duration { "amount": 5, @@ -470,7 +470,7 @@ Object { }, "metricSearch": MathExpression { "color": undefined, - "expression": "SEARCH('{DummyNamespace} DummyQuery', 'p90', 300)", + "expression": "SEARCH('{\\"DummyNamespace\\"} DummyQuery', 'p90', 300)", "label": " ", "period": Duration { "amount": 5, @@ -570,7 +570,7 @@ Object { }, "metricSearch": MathExpression { "color": undefined, - "expression": "SEARCH('{CustomTestNamespace} DummyQuery', 'p90', 900)", + "expression": "SEARCH('{\\"CustomTestNamespace\\"} DummyQuery', 'p90', 900)", "label": " ", "period": Duration { "amount": 15, @@ -670,7 +670,7 @@ Object { }, "metricSearch": MathExpression { "color": undefined, - "expression": "SEARCH('{CustomTestNamespace} DummyQuery', 'p90', 300)", + "expression": "SEARCH('{\\"CustomTestNamespace\\"} DummyQuery', 'p90', 300)", "label": " ", "period": Duration { "amount": 5, @@ -770,7 +770,7 @@ Object { }, "metricSearch": MathExpression { "color": undefined, - "expression": "SEARCH('{DummyNamespace} DummyQuery', 'p90', 900)", + "expression": "SEARCH('{\\"DummyNamespace\\"} DummyQuery', 'p90', 900)", "label": " ", "period": Duration { "amount": 15, @@ -870,7 +870,7 @@ Object { }, "metricSearch": MathExpression { "color": undefined, - "expression": "SEARCH('{DummyNamespace} DummyQuery', 'p90', 300)", + "expression": "SEARCH('{\\"DummyNamespace\\"} DummyQuery', 'p90', 300)", "label": " ", "period": Duration { "amount": 5, diff --git a/test/facade/__snapshots__/MonitoringAspect.test.ts.snap b/test/facade/__snapshots__/MonitoringAspect.test.ts.snap index a7cf64ed..d9b43e4f 100644 --- a/test/facade/__snapshots__/MonitoringAspect.test.ts.snap +++ b/test/facade/__snapshots__/MonitoringAspect.test.ts.snap @@ -3694,7 +3694,7 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/DynamoDB\\\\\\",\\\\\\"TableName\\\\\\",\\\\\\"Operation\\\\\\"} \\\\\\"TableName\\\\\\"=\\\\\\"", Object { "Ref": "DummyTable77F0C182", }, @@ -3893,19 +3893,19 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"CPUUtilization\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - OPS\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"CPUUtilization\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - OPS\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readops_classic_0, readops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_ebs_0\\"}],[{\\"label\\":\\"DiskWriteOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writeops_classic_0, writeops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - Bytes\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readops_classic_0, readops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_ebs_0\\"}],[{\\"label\\":\\"DiskWriteOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writeops_classic_0, writeops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - Bytes\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadBytes\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readbytes_classic_0, readbytes_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskReadBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readbytes_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSReadBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readbytes_ebs_0\\"}],[{\\"label\\":\\"DiskWriteBytes\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writebytes_classic_0, writebytes_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskWriteBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writebytes_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSWriteBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writebytes_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Network\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadBytes\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readbytes_classic_0, readbytes_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskReadBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readbytes_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSReadBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readbytes_ebs_0\\"}],[{\\"label\\":\\"DiskWriteBytes\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writebytes_classic_0, writebytes_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskWriteBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writebytes_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSWriteBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writebytes_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Network\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"NetworkIn\\\\\\"', 'Average', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"NetworkOut\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}}]}", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"NetworkIn\\\\\\"', 'Average', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"NetworkOut\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}}]}", ], ], }, @@ -3923,15 +3923,15 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"CPUUtilization\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - OPS\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"CPUUtilization\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - OPS\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readops_classic_0, readops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_ebs_0\\"}],[{\\"label\\":\\"DiskWriteOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writeops_classic_0, writeops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Network\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readops_classic_0, readops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_ebs_0\\"}],[{\\"label\\":\\"DiskWriteOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writeops_classic_0, writeops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Network\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"NetworkIn\\\\\\"', 'Average', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"NetworkOut\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}}]}", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"NetworkIn\\\\\\"', 'Average', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"NetworkOut\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}}]}", ], ], }, diff --git a/test/facade/__snapshots__/MonitoringFacade.test.ts.snap b/test/facade/__snapshots__/MonitoringFacade.test.ts.snap index 097a7cad..6a222a1d 100644 --- a/test/facade/__snapshots__/MonitoringFacade.test.ts.snap +++ b/test/facade/__snapshots__/MonitoringFacade.test.ts.snap @@ -28,7 +28,7 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"MyTableName\\\\\\" MetricName=\\\\\\"SuccessfulRequestLatency\\\\\\"', 'Average', 300)\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"GetItem > 10000 for 3 datapoints within 15 minutes\\",\\"value\\":10000,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":3,\\"height\\":6,\\"x\\":15,\\"y\\":2,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Throttles\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/DynamoDB\\\\\\",\\\\\\"TableName\\\\\\",\\\\\\"Operation\\\\\\"} \\\\\\"TableName\\\\\\"=\\\\\\"MyTableName\\\\\\" MetricName=\\\\\\"SuccessfulRequestLatency\\\\\\"', 'Average', 300)\\",\\"accountId\\":\\"09876543210\\",\\"region\\":\\"us-east-1\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"GetItem > 10000 for 3 datapoints within 15 minutes\\",\\"value\\":10000,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":3,\\"height\\":6,\\"x\\":15,\\"y\\":2,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Throttles\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -48,7 +48,7 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"my-other-table\\\\\\" MetricName=\\\\\\"SuccessfulRequestLatency\\\\\\"', 'Average', 300)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":3,\\"height\\":6,\\"x\\":15,\\"y\\":9,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Throttles\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/DynamoDB\\\\\\",\\\\\\"TableName\\\\\\",\\\\\\"Operation\\\\\\"} \\\\\\"TableName\\\\\\"=\\\\\\"my-other-table\\\\\\" MetricName=\\\\\\"SuccessfulRequestLatency\\\\\\"', 'Average', 300)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}},\\"legend\\":{\\"position\\":\\"right\\"}}},{\\"type\\":\\"metric\\",\\"width\\":3,\\"height\\":6,\\"x\\":15,\\"y\\":9,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Throttles\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, diff --git a/test/monitoring/aws-dynamo/__snapshots__/DynamoTableMonitoring.test.ts.snap b/test/monitoring/aws-dynamo/__snapshots__/DynamoTableMonitoring.test.ts.snap index 4f02a069..2d9e2e0d 100644 --- a/test/monitoring/aws-dynamo/__snapshots__/DynamoTableMonitoring.test.ts.snap +++ b/test/monitoring/aws-dynamo/__snapshots__/DynamoTableMonitoring.test.ts.snap @@ -226,7 +226,7 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/DynamoDB\\\\\\",\\\\\\"TableName\\\\\\",\\\\\\"Operation\\\\\\"} \\\\\\"TableName\\\\\\"=\\\\\\"", Object { "Ref": "TableCD117FA1", }, @@ -1233,7 +1233,7 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/DynamoDB\\\\\\",\\\\\\"TableName\\\\\\",\\\\\\"Operation\\\\\\"} \\\\\\"TableName\\\\\\"=\\\\\\"", Object { "Ref": "TableCD117FA1", }, @@ -1610,7 +1610,7 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/DynamoDB\\\\\\",\\\\\\"TableName\\\\\\",\\\\\\"Operation\\\\\\"} \\\\\\"TableName\\\\\\"=\\\\\\"", Object { "Ref": "TableCD117FA1", }, @@ -2598,7 +2598,7 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/DynamoDB,TableName,Operation} TableName=\\\\\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/DynamoDB\\\\\\",\\\\\\"TableName\\\\\\",\\\\\\"Operation\\\\\\"} \\\\\\"TableName\\\\\\"=\\\\\\"", Object { "Ref": "TableCD117FA1", }, diff --git a/test/monitoring/aws-ec2/__snapshots__/EC2Monitoring.test.ts.snap b/test/monitoring/aws-ec2/__snapshots__/EC2Monitoring.test.ts.snap index 35344394..e8ca8fc1 100644 --- a/test/monitoring/aws-ec2/__snapshots__/EC2Monitoring.test.ts.snap +++ b/test/monitoring/aws-ec2/__snapshots__/EC2Monitoring.test.ts.snap @@ -127,19 +127,19 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"CPUUtilization\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - OPS\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"CPUUtilization\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - OPS\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readops_classic_0, readops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_ebs_0\\"}],[{\\"label\\":\\"DiskWriteOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writeops_classic_0, writeops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - Bytes\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readops_classic_0, readops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_ebs_0\\"}],[{\\"label\\":\\"DiskWriteOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writeops_classic_0, writeops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - Bytes\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadBytes\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readbytes_classic_0, readbytes_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskReadBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readbytes_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSReadBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readbytes_ebs_0\\"}],[{\\"label\\":\\"DiskWriteBytes\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writebytes_classic_0, writebytes_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskWriteBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writebytes_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSWriteBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writebytes_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Network\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadBytes\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readbytes_classic_0, readbytes_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskReadBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readbytes_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSReadBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readbytes_ebs_0\\"}],[{\\"label\\":\\"DiskWriteBytes\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writebytes_classic_0, writebytes_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskWriteBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writebytes_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSWriteBytes\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writebytes_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Network\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"NetworkIn\\\\\\"', 'Average', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"NetworkOut\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}}]}", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"NetworkIn\\\\\\"', 'Average', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"NetworkOut\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}}]}", ], ], }, @@ -156,15 +156,15 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"CPUUtilization\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - OPS\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"CPUUtilization\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Disk - OPS\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readops_classic_0, readops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_ebs_0\\"}],[{\\"label\\":\\"DiskWriteOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writeops_classic_0, writeops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"DiskWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"EBSWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Network\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[{\\"label\\":\\"DiskReadOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([readops_classic_0, readops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSReadOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"readops_ebs_0\\"}],[{\\"label\\":\\"DiskWriteOps\\",\\"expression\\":\\"AVG(REMOVE_EMPTY([writeops_classic_0, writeops_ebs_0]))\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"DiskWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_classic_0\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"EBSWriteOps\\\\\\"', 'Average', 300)\\",\\"visible\\":false,\\"id\\":\\"writeops_ebs_0\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Network\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"NetworkIn\\\\\\"', 'Average', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{AWS/EC2,InstanceId} MetricName=\\\\\\"NetworkOut\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}}]}", + "\\",\\"metrics\\":[[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"NetworkIn\\\\\\"', 'Average', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"AWS/EC2\\\\\\",\\\\\\"InstanceId\\\\\\"} MetricName=\\\\\\"NetworkOut\\\\\\"', 'Average', 300)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"bytes\\",\\"showUnits\\":false}}}}]}", ], ], }, diff --git a/test/monitoring/custom/__snapshots__/CustomMonitoring.test.ts.snap b/test/monitoring/custom/__snapshots__/CustomMonitoring.test.ts.snap index ca5f9f20..ca4fb182 100644 --- a/test/monitoring/custom/__snapshots__/CustomMonitoring.test.ts.snap +++ b/test/monitoring/custom/__snapshots__/CustomMonitoring.test.ts.snap @@ -652,7 +652,7 @@ Object { Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[\\"DummyCustomNamespace\\",\\"DummyMetric1\\",\\"CustomDimension\\",\\"CustomDimensionValue\\"],[\\"DummyCustomNamespace\\",\\"DummyMetric2\\",\\"CustomDimension\\",\\"CustomDimensionValue\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}],[\\"DummyCustomNamespace\\",\\"DummyMetric3\\",\\"CustomDimension\\",\\"CustomDimensionValue\\"],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{DummyCustomNamespace,CustomDimension} CustomDimension=\\\\\\"CustomDimensionValue\\\\\\" DummyMetric4-', 'Sum', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{DummyCustomNamespace,CustomDimension} CustomDimension=\\\\\\"CustomDimensionValue\\\\\\" DummyMetric5-', 'Sum', 300)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"DummyMetric3 < 90 for 3 datapoints within 15 minutes\\",\\"value\\":90,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"DummyMetric3 < 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":2,\\"height\\":100,\\"x\\":6,\\"y\\":3,\\"properties\\":{\\"view\\":\\"bar\\",\\"title\\":\\"DummyGroup2\\",\\"region\\":\\"", + "\\",\\"metrics\\":[[\\"DummyCustomNamespace\\",\\"DummyMetric1\\",\\"CustomDimension\\",\\"CustomDimensionValue\\"],[\\"DummyCustomNamespace\\",\\"DummyMetric2\\",\\"CustomDimension\\",\\"CustomDimensionValue\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}],[\\"DummyCustomNamespace\\",\\"DummyMetric3\\",\\"CustomDimension\\",\\"CustomDimensionValue\\"],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"DummyCustomNamespace\\\\\\",\\\\\\"CustomDimension\\\\\\"} \\\\\\"CustomDimension\\\\\\"=\\\\\\"CustomDimensionValue\\\\\\" DummyMetric4-', 'Sum', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"DummyCustomNamespace\\\\\\",\\\\\\"CustomDimension\\\\\\"} \\\\\\"CustomDimension\\\\\\"=\\\\\\"CustomDimensionValue\\\\\\" DummyMetric5-', 'Sum', 300)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"DummyMetric3 < 90 for 3 datapoints within 15 minutes\\",\\"value\\":90,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"DummyMetric3 < 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":2,\\"height\\":100,\\"x\\":6,\\"y\\":3,\\"properties\\":{\\"view\\":\\"bar\\",\\"title\\":\\"DummyGroup2\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -907,7 +907,7 @@ Min number of samples to alarm: 5", Object { "Ref": "AWS::Region", }, - "\\",\\"metrics\\":[[\\"DummyCustomNamespace\\",\\"DummyMetric1\\",\\"CustomDimension\\",\\"CustomDimensionValue\\"],[\\"DummyCustomNamespace\\",\\"DummyMetric2\\",\\"CustomDimension\\",\\"CustomDimensionValue\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}],[\\"DummyCustomNamespace\\",\\"DummyMetric3\\",\\"CustomDimension\\",\\"CustomDimensionValue\\"],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{DummyCustomNamespace,CustomDimension} CustomDimension=\\\\\\"CustomDimensionValue\\\\\\" DummyMetric4-', 'Sum', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{DummyCustomNamespace,CustomDimension} CustomDimension=\\\\\\"CustomDimensionValue\\\\\\" DummyMetric5-', 'Sum', 300)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"DummyMetric3 < 90 for 3 datapoints within 15 minutes\\",\\"value\\":90,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"DummyMetric3 < 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{}}}]}", + "\\",\\"metrics\\":[[\\"DummyCustomNamespace\\",\\"DummyMetric1\\",\\"CustomDimension\\",\\"CustomDimensionValue\\"],[\\"DummyCustomNamespace\\",\\"DummyMetric2\\",\\"CustomDimension\\",\\"CustomDimensionValue\\",{\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}],[\\"DummyCustomNamespace\\",\\"DummyMetric3\\",\\"CustomDimension\\",\\"CustomDimensionValue\\"],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"DummyCustomNamespace\\\\\\",\\\\\\"CustomDimension\\\\\\"} \\\\\\"CustomDimension\\\\\\"=\\\\\\"CustomDimensionValue\\\\\\" DummyMetric4-', 'Sum', 300)\\"}],[{\\"label\\":\\" \\",\\"expression\\":\\"SEARCH('{\\\\\\"DummyCustomNamespace\\\\\\",\\\\\\"CustomDimension\\\\\\"} \\\\\\"CustomDimension\\\\\\"=\\\\\\"CustomDimensionValue\\\\\\" DummyMetric5-', 'Sum', 300)\\",\\"accountId\\":\\"01234567890\\",\\"region\\":\\"us-west-2\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"DummyMetric3 < 90 for 3 datapoints within 15 minutes\\",\\"value\\":90,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"DummyMetric3 < 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{}}}]}", ], ], },