From 901f3f3bac63c19e5f4c7bc1d598d7e5ada2de3b Mon Sep 17 00:00:00 2001 From: Eugene Cheung <81188333+echeung-amzn@users.noreply.github.com> Date: Fri, 13 Jan 2023 14:29:27 -0500 Subject: [PATCH] feat(lambda): include enhanced CPU and memory alarm annotations in dashboard (#298) Closes #292 --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_ --- .../aws-lambda/LambdaFunctionMonitoring.ts | 2 + .../LambdaFunctionMonitoring.test.ts | 135 +- .../LambdaFunctionMonitoring.test.ts.snap | 1872 +++++++++++++++-- 3 files changed, 1847 insertions(+), 162 deletions(-) diff --git a/lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts b/lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts index 0bc66f19..cfa173de 100644 --- a/lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts +++ b/lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts @@ -640,6 +640,7 @@ export class LambdaFunctionMonitoring extends Monitoring { /* eslint-enable @typescript-eslint/no-non-null-assertion */ ], leftYAxis: TimeAxisMillisFromZero, + leftAnnotations: this.cpuTotalTimeAnnotations, }); } @@ -656,6 +657,7 @@ export class LambdaFunctionMonitoring extends Monitoring { /* eslint-enable @typescript-eslint/no-non-null-assertion */ ], leftYAxis: PercentageAxisFromZeroToHundred, + leftAnnotations: this.memoryUsageAnnotations, }); } diff --git a/test/monitoring/aws-lambda/LambdaFunctionMonitoring.test.ts b/test/monitoring/aws-lambda/LambdaFunctionMonitoring.test.ts index 02d12be8..32b4db41 100644 --- a/test/monitoring/aws-lambda/LambdaFunctionMonitoring.test.ts +++ b/test/monitoring/aws-lambda/LambdaFunctionMonitoring.test.ts @@ -9,6 +9,7 @@ import { } from "aws-cdk-lib/aws-lambda"; import { AlarmWithAnnotation, LambdaFunctionMonitoring } from "../../../lib"; +import { addMonitoringDashboardsToStack } from "../../utils/SnapshotUtil"; import { TestMonitoringScope } from "../TestMonitoringScope"; test("snapshot test: no alarms", () => { @@ -55,7 +56,7 @@ test("snapshot test: all alarms", () => { let numAlarmsCreated = 0; - new LambdaFunctionMonitoring(scope, { + const monitoring = new LambdaFunctionMonitoring(scope, { lambdaFunction, humanReadableName: "Dummy Lambda for testing", alarmFriendlyName: "DummyLambda", @@ -143,6 +144,7 @@ test("snapshot test: all alarms", () => { }, }); + addMonitoringDashboardsToStack(stack, monitoring); expect(numAlarmsCreated).toStrictEqual(13); expect(Template.fromStack(stack)).toMatchSnapshot(); }); @@ -201,10 +203,11 @@ test("snapshot test: all alarms, alarmPrefix on error dedupeString", () => { let numAlarmsCreated = 0; - new LambdaFunctionMonitoring(scope, { + const monitoring = new LambdaFunctionMonitoring(scope, { lambdaFunction, humanReadableName: "Dummy Lambda for testing", alarmFriendlyName: "DummyLambda", + lambdaInsightsEnabled: true, addFaultRateAlarm: { Warning: { maxErrorRate: 1, @@ -282,6 +285,36 @@ test("snapshot test: all alarms, alarmPrefix on error dedupeString", () => { maxAgeInMillis: 1_000_000, }, }, + addEnhancedMonitoringMaxCpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringP90CpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringAvgCpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringMaxMemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, + addEnhancedMonitoringP90MemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, + addEnhancedMonitoringAvgMemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, useCreatedAlarms: { consume(alarms: AlarmWithAnnotation[]) { numAlarmsCreated = alarms.length; @@ -289,7 +322,8 @@ test("snapshot test: all alarms, alarmPrefix on error dedupeString", () => { }, }); - expect(numAlarmsCreated).toStrictEqual(13); + addMonitoringDashboardsToStack(stack, monitoring); + expect(numAlarmsCreated).toStrictEqual(19); expect(Template.fromStack(stack)).toMatchSnapshot(); }); @@ -307,10 +341,11 @@ test("snapshot test: all alarms, alarmPrefix on latency dedupeString", () => { let numAlarmsCreated = 0; - new LambdaFunctionMonitoring(scope, { + const monitoring = new LambdaFunctionMonitoring(scope, { lambdaFunction, humanReadableName: "Dummy Lambda for testing", alarmFriendlyName: "DummyLambda", + lambdaInsightsEnabled: true, addFaultRateAlarm: { Warning: { maxErrorRate: 1, @@ -388,6 +423,36 @@ test("snapshot test: all alarms, alarmPrefix on latency dedupeString", () => { maxAgeInMillis: 1_000_000, }, }, + addEnhancedMonitoringMaxCpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringP90CpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringAvgCpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringMaxMemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, + addEnhancedMonitoringP90MemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, + addEnhancedMonitoringAvgMemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, useCreatedAlarms: { consume(alarms: AlarmWithAnnotation[]) { numAlarmsCreated = alarms.length; @@ -395,6 +460,66 @@ test("snapshot test: all alarms, alarmPrefix on latency dedupeString", () => { }, }); - expect(numAlarmsCreated).toStrictEqual(13); + addMonitoringDashboardsToStack(stack, monitoring); + expect(numAlarmsCreated).toStrictEqual(19); expect(Template.fromStack(stack)).toMatchSnapshot(); }); + +test("doesn't create alarms for enhanced Lambda Insights metrics if not enabled", () => { + const stack = new Stack(); + + const scope = new TestMonitoringScope(stack, "Scope"); + + const lambdaFunction = new Function(stack, "Function", { + functionName: "DummyLambda", + runtime: Runtime.NODEJS_12_X, + code: InlineCode.fromInline("{}"), + handler: "Dummy::handler", + }); + + let numAlarmsCreated = 0; + + new LambdaFunctionMonitoring(scope, { + lambdaFunction, + humanReadableName: "Dummy Lambda for testing", + alarmFriendlyName: "DummyLambda", + lambdaInsightsEnabled: false, + addEnhancedMonitoringMaxCpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringP90CpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringAvgCpuTotalTimeAlarm: { + Warning: { + maxDuration: Duration.millis(100), + }, + }, + addEnhancedMonitoringMaxMemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, + addEnhancedMonitoringP90MemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, + addEnhancedMonitoringAvgMemoryUtilizationAlarm: { + Warning: { + maxUsagePercent: 50, + }, + }, + useCreatedAlarms: { + consume(alarms: AlarmWithAnnotation[]) { + numAlarmsCreated = alarms.length; + }, + }, + }); + + expect(numAlarmsCreated).toStrictEqual(0); +}); diff --git a/test/monitoring/aws-lambda/__snapshots__/LambdaFunctionMonitoring.test.ts.snap b/test/monitoring/aws-lambda/__snapshots__/LambdaFunctionMonitoring.test.ts.snap index 384894f6..c979a8ce 100644 --- a/test/monitoring/aws-lambda/__snapshots__/LambdaFunctionMonitoring.test.ts.snap +++ b/test/monitoring/aws-lambda/__snapshots__/LambdaFunctionMonitoring.test.ts.snap @@ -10,6 +10,162 @@ Object { }, }, "Resources": Object { + "Alarm7103F465": Object { + "Properties": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP50WarningE50DF463", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP90Warning670FFADC", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP99WarningDDA8F353", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaFaultCountWarning33B0A193", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaFaultRateWarningE6A1BB2B", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaMinTPSWarning30EF1FB4", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaMaxTPSWarning0EC2023E", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaThrottledCountWarning946A5E19", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaThrottledRateWarning6EB21772", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaUsageCountWarningFB9A10FB", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaRunningTasksHighWarning2A06F60A", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaRunningTasksHighCritical357223A5", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaIteratorAgeMaxWarning2BC5030F", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, "Function76856677": Object { "DependsOn": Array [ "FunctionServiceRole675BB04A", @@ -61,6 +217,103 @@ Object { }, "Type": "AWS::IAM::Role", }, + "Resource": Object { + "Properties": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"markdown\\":\\"### Lambda Function **[Dummy Lambda for testing](https://eu-west-1.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/", + Object { + "Ref": "Function76856677", + }, + ")**\\"}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":0,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[{\\"label\\":\\"TPS\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"TPS <= 0 for 1 datapoints within 5 minutes\\",\\"value\\":0,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"TPS > 20 for 1 datapoints within 5 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"P50 > 110 for 11 datapoints within 55 minutes\\",\\"value\\":110,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P90 > 220 for 22 datapoints within 110 minutes\\",\\"value\\":220,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P99 > 330 for 33 datapoints within 165 minutes\\",\\"value\\":330,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Rates\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Throttles\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Throttles (avg)\\"}],[\\"AWS/Lambda\\",\\"ProvisionedConcurrencySpilloverInvocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Provisioned Concurrency Spillovers (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Throttles (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":0,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Invocations\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/Lambda\\",\\"Throttles\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Throttles\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/Lambda\\",\\"ConcurrentExecutions\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Concurrent\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/Lambda\\",\\"ProvisionedConcurrencySpilloverInvocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Provisioned Concurrency Spillovers\\",\\"stat\\":\\"Sum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Throttles > 2 for 20 datapoints within 100 minutes\\",\\"value\\":2,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Invocations undefined 5 for 30 datapoints within 150 minutes\\",\\"value\\":5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Concurrent > 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Provisioned Concurrency Spillovers > 5 for 3 datapoints within 15 minutes\\",\\"value\\":5,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Iterator\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"IteratorAge\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Iterator Age\\",\\"stat\\":\\"Maximum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Iterator Age > 1000000 for 3 datapoints within 15 minutes\\",\\"value\\":1000000,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults\\",\\"stat\\":\\"Sum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults > 2 for 20 datapoints within 100 minutes\\",\\"value\\":2,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, "ScopeTestDummyLambdaFaultCountWarning33B0A193": Object { "Properties": Object { "ActionsEnabled": true, @@ -539,6 +792,55 @@ Object { }, "Type": "AWS::CloudWatch::Alarm", }, + "Summary68521F81": Object { + "Properties": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"markdown\\":\\"### Lambda Function **[Dummy Lambda for testing](https://eu-west-1.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/", + Object { + "Ref": "Function76856677", + }, + ")**\\"}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":0,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[{\\"label\\":\\"TPS\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"TPS <= 0 for 1 datapoints within 5 minutes\\",\\"value\\":0,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"TPS > 20 for 1 datapoints within 5 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"P50 > 110 for 11 datapoints within 55 minutes\\",\\"value\\":110,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P90 > 220 for 22 datapoints within 110 minutes\\",\\"value\\":220,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P99 > 330 for 33 datapoints within 165 minutes\\",\\"value\\":330,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, }, "Rules": Object { "CheckBootstrapVersion": Object { @@ -701,6 +1003,228 @@ Object { }, }, "Resources": Object { + "Alarm7103F465": Object { + "Properties": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaDurationP100Warning3DEE9E3B", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaDurationP90WarningA5BA76D8", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaDurationAverageWarning93C2337F", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaMemoryUsageWarningA77BC22D", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaP90MemoryUsageWarning9080CECC", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaAverageMemoryUsageWarning59BC5A6E", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP50WarningE50DF463", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP90Warning670FFADC", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP99WarningDDA8F353", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaFaultCountWarning33B0A193", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaFaultRateWarningE6A1BB2B", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaMinTPSWarning30EF1FB4", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaMaxTPSWarning0EC2023E", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaThrottledCountWarning946A5E19", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaThrottledRateWarning6EB21772", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaUsageCountWarningFB9A10FB", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaRunningTasksHighWarning2A06F60A", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaRunningTasksHighCritical357223A5", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaIteratorAgeMaxWarning2BC5030F", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, "Function76856677": Object { "DependsOn": Array [ "FunctionServiceRole675BB04A", @@ -752,19 +1276,304 @@ Object { }, "Type": "AWS::IAM::Role", }, - "ScopeTestDummyLambdaFaultCountWarning33B0A193": Object { + "Resource": Object { "Properties": Object { - "ActionsEnabled": true, - "AlarmDescription": "Fault count is too high.", - "AlarmName": "Test-DummyLambda-Fault-Count-Warning", - "ComparisonOperator": "GreaterThanThreshold", - "DatapointsToAlarm": 20, - "EvaluationPeriods": 20, - "Metrics": Array [ - Object { - "Id": "m1", - "Label": "Faults", - "MetricStat": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"markdown\\":\\"### Lambda Function **[Dummy Lambda for testing](https://eu-west-1.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/", + Object { + "Ref": "Function76856677", + }, + ")**\\"}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":0,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[{\\"label\\":\\"TPS\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"TPS <= 0 for 1 datapoints within 5 minutes\\",\\"value\\":0,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"TPS > 20 for 1 datapoints within 5 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"P50 > 110 for 11 datapoints within 55 minutes\\",\\"value\\":110,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P90 > 220 for 22 datapoints within 110 minutes\\",\\"value\\":220,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P99 > 330 for 33 datapoints within 165 minutes\\",\\"value\\":330,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Rates\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Throttles\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Throttles (avg)\\"}],[\\"AWS/Lambda\\",\\"ProvisionedConcurrencySpilloverInvocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Provisioned Concurrency Spillovers (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Throttles (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":0,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Invocations\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/Lambda\\",\\"Throttles\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Throttles\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/Lambda\\",\\"ConcurrentExecutions\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Concurrent\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/Lambda\\",\\"ProvisionedConcurrencySpilloverInvocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Provisioned Concurrency Spillovers\\",\\"stat\\":\\"Sum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Throttles > 2 for 20 datapoints within 100 minutes\\",\\"value\\":2,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Invocations undefined 5 for 30 datapoints within 150 minutes\\",\\"value\\":5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Concurrent > 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Provisioned Concurrency Spillovers > 5 for 3 datapoints within 15 minutes\\",\\"value\\":5,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Iterator\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"IteratorAge\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Iterator Age\\",\\"stat\\":\\"Maximum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Iterator Age > 1000000 for 3 datapoints within 15 minutes\\",\\"value\\":1000000,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults\\",\\"stat\\":\\"Sum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults > 2 for 20 datapoints within 100 minutes\\",\\"value\\":2,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":0,\\"y\\":11,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"CPU Total Time\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"LambdaInsights\\",\\"cpu_total_time\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"CPUTotalTime.Max\\",\\"stat\\":\\"Maximum\\"}],[\\"LambdaInsights\\",\\"cpu_total_time\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"CPUTotalTime.P90\\",\\"stat\\":\\"p90\\"}],[\\"LambdaInsights\\",\\"cpu_total_time\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"CPUTotalTime.Avg\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"CPUTotalTime.Max > 100 for 3 datapoints within 15 minutes\\",\\"value\\":100,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"CPUTotalTime.P90 > 100 for 3 datapoints within 15 minutes\\",\\"value\\":100,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"CPUTotalTime.Avg > 100 for 3 datapoints within 15 minutes\\",\\"value\\":100,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":11,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Memory Utilization\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"LambdaInsights\\",\\"memory_utilization\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"MemoryUtilization.Max\\",\\"stat\\":\\"Maximum\\"}],[\\"LambdaInsights\\",\\"memory_utilization\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"MemoryUtilization.P90\\",\\"stat\\":\\"p90\\"}],[\\"LambdaInsights\\",\\"memory_utilization\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"MemoryUtilization.Avg\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"MemoryUtilization.Max > 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"MemoryUtilization.P90 > 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"MemoryUtilization.Avg > 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":11,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Function Cost\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[{\\"label\\":\\"Function Cost (avg: \${AVG}, max: \${MAX})\\",\\"expression\\":\\"memory_utilization * duration\\"}],[\\"LambdaInsights\\",\\"memory_utilization\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"MemoryUtilization.Max\\",\\"stat\\":\\"Maximum\\",\\"visible\\":false,\\"id\\":\\"memory_utilization\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"duration\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"MB*ms\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, + "ScopeTestDummyLambdaAverageMemoryUsageWarning59BC5A6E": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "The memory usage is too high.", + "AlarmName": "Test-DummyLambda-Average-Memory-Usage-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "MemoryUtilization.Avg", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "function_name", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "memory_utilization", + "Namespace": "LambdaInsights", + }, + "Period": 300, + "Stat": "Average", + }, + "ReturnData": true, + }, + ], + "Threshold": 50, + "TreatMissingData": "missing", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "ScopeTestDummyLambdaDurationAverageWarning93C2337F": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "Average duration is too long.", + "AlarmName": "Test-DummyLambda-Duration-Average-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "CPUTotalTime.Avg", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "function_name", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "cpu_total_time", + "Namespace": "LambdaInsights", + }, + "Period": 300, + "Stat": "Average", + }, + "ReturnData": true, + }, + ], + "Threshold": 100, + "TreatMissingData": "notBreaching", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "ScopeTestDummyLambdaDurationP100Warning3DEE9E3B": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "P100 duration is too long.", + "AlarmName": "Test-DummyLambda-Duration-P100-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "CPUTotalTime.Max", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "function_name", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "cpu_total_time", + "Namespace": "LambdaInsights", + }, + "Period": 300, + "Stat": "Maximum", + }, + "ReturnData": true, + }, + ], + "Threshold": 100, + "TreatMissingData": "notBreaching", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "ScopeTestDummyLambdaDurationP90WarningA5BA76D8": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "P90 duration is too long.", + "AlarmName": "Test-DummyLambda-Duration-P90-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "CPUTotalTime.P90", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "function_name", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "cpu_total_time", + "Namespace": "LambdaInsights", + }, + "Period": 300, + "Stat": "p90", + }, + "ReturnData": true, + }, + ], + "Threshold": 100, + "TreatMissingData": "notBreaching", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "ScopeTestDummyLambdaFaultCountWarning33B0A193": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "Fault count is too high.", + "AlarmName": "Test-DummyLambda-Fault-Count-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 20, + "EvaluationPeriods": 20, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "Faults", + "MetricStat": Object { "Metric": Object { "Dimensions": Array [ Object { @@ -1009,6 +1818,42 @@ Object { }, "Type": "AWS::CloudWatch::Alarm", }, + "ScopeTestDummyLambdaMemoryUsageWarningA77BC22D": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "The memory usage is too high.", + "AlarmName": "Test-DummyLambda-Memory-Usage-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "MemoryUtilization.Max", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "function_name", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "memory_utilization", + "Namespace": "LambdaInsights", + }, + "Period": 300, + "Stat": "Maximum", + }, + "ReturnData": true, + }, + ], + "Threshold": 50, + "TreatMissingData": "missing", + }, + "Type": "AWS::CloudWatch::Alarm", + }, "ScopeTestDummyLambdaMinTPSWarning30EF1FB4": Object { "Properties": Object { "ActionsEnabled": true, @@ -1050,6 +1895,42 @@ Object { }, "Type": "AWS::CloudWatch::Alarm", }, + "ScopeTestDummyLambdaP90MemoryUsageWarning9080CECC": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "The memory usage is too high.", + "AlarmName": "Test-DummyLambda-P90-Memory-Usage-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "MemoryUtilization.P90", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "function_name", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "memory_utilization", + "Namespace": "LambdaInsights", + }, + "Period": 300, + "Stat": "p90", + }, + "ReturnData": true, + }, + ], + "Threshold": 50, + "TreatMissingData": "missing", + }, + "Type": "AWS::CloudWatch::Alarm", + }, "ScopeTestDummyLambdaRunningTasksHighCritical357223A5": Object { "Properties": Object { "ActionsEnabled": true, @@ -1075,253 +1956,809 @@ Object { "MetricName": "ProvisionedConcurrencySpilloverInvocations", "Namespace": "AWS/Lambda", }, - "Period": 300, - "Stat": "Sum", - }, - "ReturnData": true, - }, - ], - "Threshold": 5, - "TreatMissingData": "missing", + "Period": 300, + "Stat": "Sum", + }, + "ReturnData": true, + }, + ], + "Threshold": 5, + "TreatMissingData": "missing", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "ScopeTestDummyLambdaRunningTasksHighWarning2A06F60A": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "Number of running tasks are too high.", + "AlarmName": "Test-DummyLambda-Running-Tasks-High-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "Concurrent", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "FunctionName", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "ConcurrentExecutions", + "Namespace": "AWS/Lambda", + }, + "Period": 300, + "Stat": "Maximum", + }, + "ReturnData": true, + }, + ], + "Threshold": 10, + "TreatMissingData": "missing", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "ScopeTestDummyLambdaThrottledCountWarning946A5E19": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "Throttled count is too high.", + "AlarmName": "Test-DummyLambda-Throttled-Count-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 20, + "EvaluationPeriods": 20, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "Throttles", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "FunctionName", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "Throttles", + "Namespace": "AWS/Lambda", + }, + "Period": 300, + "Stat": "Sum", + }, + "ReturnData": true, + }, + ], + "Threshold": 2, + "TreatMissingData": "notBreaching", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "ScopeTestDummyLambdaThrottledRateWarning6EB21772": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "Throttled rate is too high.", + "AlarmName": "Test-DummyLambda-Throttled-Rate-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 10, + "EvaluationPeriods": 10, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "Throttles (avg)", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "FunctionName", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "Throttles", + "Namespace": "AWS/Lambda", + }, + "Period": 300, + "Stat": "Average", + }, + "ReturnData": true, + }, + ], + "Threshold": 1, + "TreatMissingData": "notBreaching", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "ScopeTestDummyLambdaUsageCountWarningFB9A10FB": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "The count is too low.", + "AlarmName": "Test-DummyLambda-Usage-Count-Warning", + "ComparisonOperator": "LessThanLowerThreshold", + "DatapointsToAlarm": 30, + "EvaluationPeriods": 30, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "Invocations", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "FunctionName", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "Invocations", + "Namespace": "AWS/Lambda", + }, + "Period": 300, + "Stat": "Sum", + }, + "ReturnData": true, + }, + ], + "Threshold": 5, + "TreatMissingData": "missing", + }, + "Type": "AWS::CloudWatch::Alarm", + }, + "Summary68521F81": Object { + "Properties": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"markdown\\":\\"### Lambda Function **[Dummy Lambda for testing](https://eu-west-1.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/", + Object { + "Ref": "Function76856677", + }, + ")**\\"}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":0,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[{\\"label\\":\\"TPS\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"TPS <= 0 for 1 datapoints within 5 minutes\\",\\"value\\":0,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"TPS > 20 for 1 datapoints within 5 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"P50 > 110 for 11 datapoints within 55 minutes\\",\\"value\\":110,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P90 > 220 for 22 datapoints within 110 minutes\\",\\"value\\":220,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P99 > 330 for 33 datapoints within 165 minutes\\",\\"value\\":330,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, + }, + "Rules": Object { + "CheckBootstrapVersion": Object { + "Assertions": Array [ + Object { + "Assert": Object { + "Fn::Not": Array [ + Object { + "Fn::Contains": Array [ + Array [ + "1", + "2", + "3", + "4", + "5", + ], + Object { + "Ref": "BootstrapVersion", + }, + ], + }, + ], + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.", + }, + ], + }, + }, +} +`; + +exports[`snapshot test: all alarms, alarmPrefix on latency dedupeString 1`] = ` +Object { + "Parameters": Object { + "BootstrapVersion": Object { + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]", + "Type": "AWS::SSM::Parameter::Value", + }, + }, + "Resources": Object { + "Alarm7103F465": Object { + "Properties": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaDurationP100Warning3DEE9E3B", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaDurationP90WarningA5BA76D8", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaDurationAverageWarning93C2337F", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":0,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaMemoryUsageWarningA77BC22D", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaP90MemoryUsageWarning9080CECC", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaAverageMemoryUsageWarning59BC5A6E", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP50WarningE50DF463", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":4,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP90Warning670FFADC", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaLatencyP99WarningDDA8F353", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaFaultCountWarning33B0A193", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaFaultRateWarningE6A1BB2B", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaMinTPSWarning30EF1FB4", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaMaxTPSWarning0EC2023E", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaThrottledCountWarning946A5E19", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaThrottledRateWarning6EB21772", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":18,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaUsageCountWarningFB9A10FB", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":0,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaRunningTasksHighWarning2A06F60A", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":6,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaRunningTasksHighCritical357223A5", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":4,\\"x\\":12,\\"y\\":16,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"annotations\\":{\\"alarms\\":[\\"", + Object { + "Fn::GetAtt": Array [ + "ScopeTestDummyLambdaIteratorAgeMaxWarning2BC5030F", + "Arn", + ], + }, + "\\"]},\\"yAxis\\":{}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, + "Function76856677": Object { + "DependsOn": Array [ + "FunctionServiceRole675BB04A", + ], + "Properties": Object { + "Code": Object { + "ZipFile": "{}", + }, + "FunctionName": "DummyLambda", + "Handler": "Dummy::handler", + "Role": Object { + "Fn::GetAtt": Array [ + "FunctionServiceRole675BB04A", + "Arn", + ], + }, + "Runtime": "nodejs12.x", + }, + "Type": "AWS::Lambda::Function", + }, + "FunctionServiceRole675BB04A": Object { + "Properties": Object { + "AssumeRolePolicyDocument": Object { + "Statement": Array [ + Object { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": Object { + "Service": "lambda.amazonaws.com", + }, + }, + ], + "Version": "2012-10-17", + }, + "ManagedPolicyArns": Array [ + Object { + "Fn::Join": Array [ + "", + Array [ + "arn:", + Object { + "Ref": "AWS::Partition", + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + ], + ], + }, + ], + }, + "Type": "AWS::IAM::Role", + }, + "Resource": Object { + "Properties": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"markdown\\":\\"### Lambda Function **[Dummy Lambda for testing](https://eu-west-1.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/", + Object { + "Ref": "Function76856677", + }, + ")**\\"}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":0,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[{\\"label\\":\\"TPS\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"TPS <= 0 for 1 datapoints within 5 minutes\\",\\"value\\":0,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"TPS > 20 for 1 datapoints within 5 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"P50 > 110 for 11 datapoints within 55 minutes\\",\\"value\\":110,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P90 > 220 for 22 datapoints within 110 minutes\\",\\"value\\":220,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P99 > 330 for 33 datapoints within 165 minutes\\",\\"value\\":330,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Rates\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Throttles\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Throttles (avg)\\"}],[\\"AWS/Lambda\\",\\"ProvisionedConcurrencySpilloverInvocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Provisioned Concurrency Spillovers (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Throttles (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":0,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Invocations\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/Lambda\\",\\"Throttles\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Throttles\\",\\"stat\\":\\"Sum\\"}],[\\"AWS/Lambda\\",\\"ConcurrentExecutions\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Concurrent\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/Lambda\\",\\"ProvisionedConcurrencySpilloverInvocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Provisioned Concurrency Spillovers\\",\\"stat\\":\\"Sum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Throttles > 2 for 20 datapoints within 100 minutes\\",\\"value\\":2,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Invocations undefined 5 for 30 datapoints within 150 minutes\\",\\"value\\":5,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Concurrent > 10 for 3 datapoints within 15 minutes\\",\\"value\\":10,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"Provisioned Concurrency Spillovers > 5 for 3 datapoints within 15 minutes\\",\\"value\\":5,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Iterator\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"IteratorAge\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Iterator Age\\",\\"stat\\":\\"Maximum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Iterator Age > 1000000 for 3 datapoints within 15 minutes\\",\\"value\\":1000000,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults\\",\\"stat\\":\\"Sum\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults > 2 for 20 datapoints within 100 minutes\\",\\"value\\":2,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":0,\\"y\\":11,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"CPU Total Time\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"LambdaInsights\\",\\"cpu_total_time\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"CPUTotalTime.Max\\",\\"stat\\":\\"Maximum\\"}],[\\"LambdaInsights\\",\\"cpu_total_time\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"CPUTotalTime.P90\\",\\"stat\\":\\"p90\\"}],[\\"LambdaInsights\\",\\"cpu_total_time\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"CPUTotalTime.Avg\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"CPUTotalTime.Max > 100 for 3 datapoints within 15 minutes\\",\\"value\\":100,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"CPUTotalTime.P90 > 100 for 3 datapoints within 15 minutes\\",\\"value\\":100,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"CPUTotalTime.Avg > 100 for 3 datapoints within 15 minutes\\",\\"value\\":100,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":11,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Memory Utilization\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"LambdaInsights\\",\\"memory_utilization\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"MemoryUtilization.Max\\",\\"stat\\":\\"Maximum\\"}],[\\"LambdaInsights\\",\\"memory_utilization\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"MemoryUtilization.P90\\",\\"stat\\":\\"p90\\"}],[\\"LambdaInsights\\",\\"memory_utilization\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"MemoryUtilization.Avg\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"MemoryUtilization.Max > 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"MemoryUtilization.P90 > 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"MemoryUtilization.Avg > 50 for 3 datapoints within 15 minutes\\",\\"value\\":50,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":11,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Function Cost\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[{\\"label\\":\\"Function Cost (avg: \${AVG}, max: \${MAX})\\",\\"expression\\":\\"memory_utilization * duration\\"}],[\\"LambdaInsights\\",\\"memory_utilization\\",\\"function_name\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"MemoryUtilization.Max\\",\\"stat\\":\\"Maximum\\",\\"visible\\":false,\\"id\\":\\"memory_utilization\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"duration\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"MB*ms\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, }, - "Type": "AWS::CloudWatch::Alarm", + "Type": "AWS::CloudWatch::Dashboard", }, - "ScopeTestDummyLambdaRunningTasksHighWarning2A06F60A": Object { + "ScopeTestDummyLambdaAverageMemoryUsageWarning59BC5A6E": Object { "Properties": Object { "ActionsEnabled": true, - "AlarmDescription": "Number of running tasks are too high.", - "AlarmName": "Test-DummyLambda-Running-Tasks-High-Warning", + "AlarmDescription": "The memory usage is too high.", + "AlarmName": "Test-DummyLambda-Average-Memory-Usage-Warning", "ComparisonOperator": "GreaterThanThreshold", "DatapointsToAlarm": 3, "EvaluationPeriods": 3, "Metrics": Array [ Object { "Id": "m1", - "Label": "Concurrent", + "Label": "MemoryUtilization.Avg", "MetricStat": Object { "Metric": Object { "Dimensions": Array [ Object { - "Name": "FunctionName", + "Name": "function_name", "Value": Object { "Ref": "Function76856677", }, }, ], - "MetricName": "ConcurrentExecutions", - "Namespace": "AWS/Lambda", + "MetricName": "memory_utilization", + "Namespace": "LambdaInsights", }, "Period": 300, - "Stat": "Maximum", + "Stat": "Average", }, "ReturnData": true, }, ], - "Threshold": 10, + "Threshold": 50, "TreatMissingData": "missing", }, "Type": "AWS::CloudWatch::Alarm", }, - "ScopeTestDummyLambdaThrottledCountWarning946A5E19": Object { + "ScopeTestDummyLambdaDurationAverageWarning93C2337F": Object { "Properties": Object { "ActionsEnabled": true, - "AlarmDescription": "Throttled count is too high.", - "AlarmName": "Test-DummyLambda-Throttled-Count-Warning", + "AlarmDescription": "Average duration is too long.", + "AlarmName": "Test-DummyLambda-Duration-Average-Warning", "ComparisonOperator": "GreaterThanThreshold", - "DatapointsToAlarm": 20, - "EvaluationPeriods": 20, + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, "Metrics": Array [ Object { "Id": "m1", - "Label": "Throttles", + "Label": "CPUTotalTime.Avg", "MetricStat": Object { "Metric": Object { "Dimensions": Array [ Object { - "Name": "FunctionName", + "Name": "function_name", "Value": Object { "Ref": "Function76856677", }, }, ], - "MetricName": "Throttles", - "Namespace": "AWS/Lambda", + "MetricName": "cpu_total_time", + "Namespace": "LambdaInsights", }, "Period": 300, - "Stat": "Sum", + "Stat": "Average", }, "ReturnData": true, }, ], - "Threshold": 2, + "Threshold": 100, "TreatMissingData": "notBreaching", }, "Type": "AWS::CloudWatch::Alarm", }, - "ScopeTestDummyLambdaThrottledRateWarning6EB21772": Object { + "ScopeTestDummyLambdaDurationP100Warning3DEE9E3B": Object { "Properties": Object { "ActionsEnabled": true, - "AlarmDescription": "Throttled rate is too high.", - "AlarmName": "Test-DummyLambda-Throttled-Rate-Warning", + "AlarmDescription": "P100 duration is too long.", + "AlarmName": "Test-DummyLambda-Duration-P100-Warning", "ComparisonOperator": "GreaterThanThreshold", - "DatapointsToAlarm": 10, - "EvaluationPeriods": 10, + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, "Metrics": Array [ Object { "Id": "m1", - "Label": "Throttles (avg)", + "Label": "CPUTotalTime.Max", "MetricStat": Object { "Metric": Object { "Dimensions": Array [ Object { - "Name": "FunctionName", + "Name": "function_name", "Value": Object { "Ref": "Function76856677", }, }, ], - "MetricName": "Throttles", - "Namespace": "AWS/Lambda", + "MetricName": "cpu_total_time", + "Namespace": "LambdaInsights", }, "Period": 300, - "Stat": "Average", + "Stat": "Maximum", }, "ReturnData": true, }, ], - "Threshold": 1, + "Threshold": 100, "TreatMissingData": "notBreaching", }, "Type": "AWS::CloudWatch::Alarm", }, - "ScopeTestDummyLambdaUsageCountWarningFB9A10FB": Object { + "ScopeTestDummyLambdaDurationP90WarningA5BA76D8": Object { "Properties": Object { "ActionsEnabled": true, - "AlarmDescription": "The count is too low.", - "AlarmName": "Test-DummyLambda-Usage-Count-Warning", - "ComparisonOperator": "LessThanLowerThreshold", - "DatapointsToAlarm": 30, - "EvaluationPeriods": 30, + "AlarmDescription": "P90 duration is too long.", + "AlarmName": "Test-DummyLambda-Duration-P90-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, "Metrics": Array [ Object { "Id": "m1", - "Label": "Invocations", + "Label": "CPUTotalTime.P90", "MetricStat": Object { "Metric": Object { "Dimensions": Array [ Object { - "Name": "FunctionName", + "Name": "function_name", "Value": Object { "Ref": "Function76856677", }, }, ], - "MetricName": "Invocations", - "Namespace": "AWS/Lambda", + "MetricName": "cpu_total_time", + "Namespace": "LambdaInsights", }, "Period": 300, - "Stat": "Sum", + "Stat": "p90", }, "ReturnData": true, }, ], - "Threshold": 5, - "TreatMissingData": "missing", + "Threshold": 100, + "TreatMissingData": "notBreaching", }, "Type": "AWS::CloudWatch::Alarm", }, - }, - "Rules": Object { - "CheckBootstrapVersion": Object { - "Assertions": Array [ - Object { - "Assert": Object { - "Fn::Not": Array [ - Object { - "Fn::Contains": Array [ - Array [ - "1", - "2", - "3", - "4", - "5", - ], - Object { - "Ref": "BootstrapVersion", - }, - ], - }, - ], - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.", - }, - ], - }, - }, -} -`; - -exports[`snapshot test: all alarms, alarmPrefix on latency dedupeString 1`] = ` -Object { - "Parameters": Object { - "BootstrapVersion": Object { - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]", - "Type": "AWS::SSM::Parameter::Value", - }, - }, - "Resources": Object { - "Function76856677": Object { - "DependsOn": Array [ - "FunctionServiceRole675BB04A", - ], - "Properties": Object { - "Code": Object { - "ZipFile": "{}", - }, - "FunctionName": "DummyLambda", - "Handler": "Dummy::handler", - "Role": Object { - "Fn::GetAtt": Array [ - "FunctionServiceRole675BB04A", - "Arn", - ], - }, - "Runtime": "nodejs12.x", - }, - "Type": "AWS::Lambda::Function", - }, - "FunctionServiceRole675BB04A": Object { - "Properties": Object { - "AssumeRolePolicyDocument": Object { - "Statement": Array [ - Object { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": Object { - "Service": "lambda.amazonaws.com", - }, - }, - ], - "Version": "2012-10-17", - }, - "ManagedPolicyArns": Array [ - Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - ], - ], - }, - ], - }, - "Type": "AWS::IAM::Role", - }, "ScopeTestDummyLambdaFaultCountWarning33B0A193": Object { "Properties": Object { "ActionsEnabled": true, @@ -1579,6 +3016,42 @@ Object { }, "Type": "AWS::CloudWatch::Alarm", }, + "ScopeTestDummyLambdaMemoryUsageWarningA77BC22D": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "The memory usage is too high.", + "AlarmName": "Test-DummyLambda-Memory-Usage-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "MemoryUtilization.Max", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "function_name", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "memory_utilization", + "Namespace": "LambdaInsights", + }, + "Period": 300, + "Stat": "Maximum", + }, + "ReturnData": true, + }, + ], + "Threshold": 50, + "TreatMissingData": "missing", + }, + "Type": "AWS::CloudWatch::Alarm", + }, "ScopeTestDummyLambdaMinTPSWarning30EF1FB4": Object { "Properties": Object { "ActionsEnabled": true, @@ -1620,6 +3093,42 @@ Object { }, "Type": "AWS::CloudWatch::Alarm", }, + "ScopeTestDummyLambdaP90MemoryUsageWarning9080CECC": Object { + "Properties": Object { + "ActionsEnabled": true, + "AlarmDescription": "The memory usage is too high.", + "AlarmName": "Test-DummyLambda-P90-Memory-Usage-Warning", + "ComparisonOperator": "GreaterThanThreshold", + "DatapointsToAlarm": 3, + "EvaluationPeriods": 3, + "Metrics": Array [ + Object { + "Id": "m1", + "Label": "MemoryUtilization.P90", + "MetricStat": Object { + "Metric": Object { + "Dimensions": Array [ + Object { + "Name": "function_name", + "Value": Object { + "Ref": "Function76856677", + }, + }, + ], + "MetricName": "memory_utilization", + "Namespace": "LambdaInsights", + }, + "Period": 300, + "Stat": "p90", + }, + "ReturnData": true, + }, + ], + "Threshold": 50, + "TreatMissingData": "missing", + }, + "Type": "AWS::CloudWatch::Alarm", + }, "ScopeTestDummyLambdaRunningTasksHighCritical357223A5": Object { "Properties": Object { "ActionsEnabled": true, @@ -1800,6 +3309,55 @@ Object { }, "Type": "AWS::CloudWatch::Alarm", }, + "Summary68521F81": Object { + "Properties": Object { + "DashboardBody": Object { + "Fn::Join": Array [ + "", + Array [ + "{\\"widgets\\":[{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":0,\\"properties\\":{\\"markdown\\":\\"### Lambda Function **[Dummy Lambda for testing](https://eu-west-1.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/", + Object { + "Ref": "Function76856677", + }, + ")**\\"}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":0,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[{\\"label\\":\\"TPS\\",\\"expression\\":\\"FILL(requests,0) / PERIOD(requests)\\"}],[\\"AWS/Lambda\\",\\"Invocations\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Invocations\\",\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"TPS <= 0 for 1 datapoints within 5 minutes\\",\\"value\\":0,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"TPS > 20 for 1 datapoints within 5 minutes\\",\\"value\\":20,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":8,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Latency\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"P50 > 110 for 11 datapoints within 55 minutes\\",\\"value\\":110,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P90 > 220 for 22 datapoints within 110 minutes\\",\\"value\\":220,\\"yAxis\\":\\"left\\"},{\\"label\\":\\"P99 > 330 for 33 datapoints within 165 minutes\\",\\"value\\":330,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":6,\\"x\\":16,\\"y\\":1,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors (rate)\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults (avg)\\"}]],\\"annotations\\":{\\"horizontal\\":[{\\"label\\":\\"Faults (avg) > 1 for 10 datapoints within 50 minutes\\",\\"value\\":1,\\"yAxis\\":\\"left\\"}]},\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, }, "Rules": Object { "CheckBootstrapVersion": Object {