diff --git a/API.md b/API.md index f71bd50c..5e209d9d 100644 --- a/API.md +++ b/API.md @@ -26285,6 +26285,7 @@ const lambdaFunctionMonitoringOptions: LambdaFunctionMonitoringOptions = { ... } | addProvisionedConcurrencySpilloverInvocationsRateAlarm | {[ key: string ]: RunningTaskRateThreshold} | *No description.* | | addThrottlesCountAlarm | {[ key: string ]: ErrorCountThreshold} | *No description.* | | addThrottlesRateAlarm | {[ key: string ]: ErrorRateThreshold} | *No description.* | +| isIterator | boolean | Indicates that the Lambda function handles an event source (e.g. DynamoDB event stream). This impacts what widgets are shown, as well as validates the ability to use addMaxIteratorAgeAlarm. | --- @@ -26626,6 +26627,19 @@ public readonly addThrottlesRateAlarm: {[ key: string ]: ErrorRateThreshold}; --- +##### `isIterator`Optional + +```typescript +public readonly isIterator: boolean; +``` + +- *Type:* boolean +- *Default:* true + +Indicates that the Lambda function handles an event source (e.g. DynamoDB event stream). This impacts what widgets are shown, as well as validates the ability to use addMaxIteratorAgeAlarm. + +--- + ### LambdaFunctionMonitoringProps #### Initializer @@ -26674,6 +26688,7 @@ const lambdaFunctionMonitoringProps: LambdaFunctionMonitoringProps = { ... } | addProvisionedConcurrencySpilloverInvocationsRateAlarm | {[ key: string ]: RunningTaskRateThreshold} | *No description.* | | addThrottlesCountAlarm | {[ key: string ]: ErrorCountThreshold} | *No description.* | | addThrottlesRateAlarm | {[ key: string ]: ErrorRateThreshold} | *No description.* | +| isIterator | boolean | Indicates that the Lambda function handles an event source (e.g. DynamoDB event stream). This impacts what widgets are shown, as well as validates the ability to use addMaxIteratorAgeAlarm. | --- @@ -27063,6 +27078,19 @@ public readonly addThrottlesRateAlarm: {[ key: string ]: ErrorRateThreshold}; --- +##### `isIterator`Optional + +```typescript +public readonly isIterator: boolean; +``` + +- *Type:* boolean +- *Default:* true + +Indicates that the Lambda function handles an event source (e.g. DynamoDB event stream). This impacts what widgets are shown, as well as validates the ability to use addMaxIteratorAgeAlarm. + +--- + ### LatencyThreshold #### Initializer @@ -64924,6 +64952,7 @@ public createTpsWidget(width: number, height: number): GraphWidget | invocationCountAnnotations | aws-cdk-lib.aws_cloudwatch.HorizontalAnnotation[] | *No description.* | | invocationCountMetric | aws-cdk-lib.aws_cloudwatch.Metric \| aws-cdk-lib.aws_cloudwatch.MathExpression | *No description.* | | invocationRateAnnotations | aws-cdk-lib.aws_cloudwatch.HorizontalAnnotation[] | *No description.* | +| isIterator | boolean | *No description.* | | lambdaInsightsEnabled | boolean | *No description.* | | latencyAlarmFactory | LatencyAlarmFactory | *No description.* | | latencyAnnotations | aws-cdk-lib.aws_cloudwatch.HorizontalAnnotation[] | *No description.* | @@ -65078,6 +65107,16 @@ public readonly invocationRateAnnotations: HorizontalAnnotation[]; --- +##### `isIterator`Required + +```typescript +public readonly isIterator: boolean; +``` + +- *Type:* boolean + +--- + ##### `lambdaInsightsEnabled`Required ```typescript diff --git a/lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts b/lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts index 9e637f25..00b80469 100644 --- a/lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts +++ b/lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts @@ -23,6 +23,7 @@ import { ErrorCountThreshold, ErrorRateThreshold, ErrorType, + HalfWidth, HighTpsThreshold, LatencyAlarmFactory, LatencyThreshold, @@ -53,6 +54,14 @@ import { } from "../../dashboard"; export interface LambdaFunctionMonitoringOptions extends BaseMonitoringProps { + /** + * Indicates that the Lambda function handles an event source (e.g. DynamoDB event stream). + * This impacts what widgets are shown, as well as validates the ability to use addMaxIteratorAgeAlarm. + * + * @default - true + */ + readonly isIterator?: boolean; + readonly addLatencyP50Alarm?: Record; readonly addLatencyP90Alarm?: Record; readonly addLatencyP99Alarm?: Record; @@ -153,6 +162,8 @@ export class LambdaFunctionMonitoring extends Monitoring { readonly concurrentExecutionsCountMetric: MetricWithAlarmSupport; readonly provisionedConcurrencySpilloverInvocationsCountMetric: MetricWithAlarmSupport; readonly provisionedConcurrencySpilloverInvocationsRateMetric: MetricWithAlarmSupport; + + readonly isIterator: boolean; readonly maxIteratorAgeMetric: MetricWithAlarmSupport; readonly lambdaInsightsEnabled: boolean; @@ -227,6 +238,8 @@ export class LambdaFunctionMonitoring extends Monitoring { this.metricFactory.metricProvisionedConcurrencySpilloverInvocations(); this.provisionedConcurrencySpilloverInvocationsRateMetric = this.metricFactory.metricProvisionedConcurrencySpilloverRate(); + + this.isIterator = props.isIterator ?? true; this.maxIteratorAgeMetric = this.metricFactory.metricMaxIteratorAgeInMillis(); @@ -493,6 +506,12 @@ export class LambdaFunctionMonitoring extends Monitoring { this.addAlarm(createdAlarm); } for (const disambiguator in props.addMaxIteratorAgeAlarm) { + if (!this.isIterator) { + throw new Error( + "addMaxIteratorAgeAlarm is not applicable if isIterator is not true", + ); + } + const alarmProps = props.addMaxIteratorAgeAlarm[disambiguator]; const createdAlarm = this.ageAlarmFactory.addIteratorMaxAgeAlarm( this.maxIteratorAgeMetric, @@ -524,13 +543,25 @@ export class LambdaFunctionMonitoring extends Monitoring { this.createErrorRateWidget(QuarterWidth, DefaultGraphWidgetHeight), this.createRateWidget(QuarterWidth, DefaultGraphWidgetHeight), ), - new Row( - this.createInvocationWidget(ThirdWidth, DefaultGraphWidgetHeight), - this.createIteratorAgeWidget(ThirdWidth, DefaultGraphWidgetHeight), - this.createErrorCountWidget(ThirdWidth, DefaultGraphWidgetHeight), - ), ]; + if (this.isIterator) { + widgets.push( + new Row( + this.createInvocationWidget(ThirdWidth, DefaultGraphWidgetHeight), + this.createIteratorAgeWidget(ThirdWidth, DefaultGraphWidgetHeight), + this.createErrorCountWidget(ThirdWidth, DefaultGraphWidgetHeight), + ), + ); + } else { + widgets.push( + new Row( + this.createInvocationWidget(HalfWidth, DefaultGraphWidgetHeight), + this.createErrorCountWidget(HalfWidth, DefaultGraphWidgetHeight), + ), + ); + } + if (this.lambdaInsightsEnabled) { widgets.push( new Row( diff --git a/test/monitoring/aws-lambda/LambdaFunctionMonitoring.test.ts b/test/monitoring/aws-lambda/LambdaFunctionMonitoring.test.ts index 2190993b..79bc366f 100644 --- a/test/monitoring/aws-lambda/LambdaFunctionMonitoring.test.ts +++ b/test/monitoring/aws-lambda/LambdaFunctionMonitoring.test.ts @@ -12,7 +12,7 @@ import { AlarmWithAnnotation, LambdaFunctionMonitoring } from "../../../lib"; import { addMonitoringDashboardsToStack } from "../../utils/SnapshotUtil"; import { TestMonitoringScope } from "../TestMonitoringScope"; -test("snapshot test: no alarms", () => { +test("snapshot test: default iterator and no alarms", () => { const stack = new Stack(); const scope = new TestMonitoringScope(stack, "Scope"); @@ -24,14 +24,14 @@ test("snapshot test: no alarms", () => { handler: "Dummy::handler", }); - new LambdaFunctionMonitoring(scope, { + const monitoring = new LambdaFunctionMonitoring(scope, { lambdaFunction, humanReadableName: "Dummy Lambda for testing", alarmFriendlyName: "DummyLambda", }); + addMonitoringDashboardsToStack(stack, monitoring); // alternative: use reference - new LambdaFunctionMonitoring(scope, { lambdaFunction: Function.fromFunctionAttributes(stack, "DummyFunctionRef", { functionArn: @@ -42,6 +42,29 @@ test("snapshot test: no alarms", () => { expect(Template.fromStack(stack)).toMatchSnapshot(); }); +test("snapshot test: non-iterator and no alarms", () => { + const stack = new Stack(); + + const scope = new TestMonitoringScope(stack, "Scope"); + + const lambdaFunction = new Function(stack, "Function", { + functionName: "DummyLambda", + runtime: Runtime.NODEJS_18_X, + code: InlineCode.fromInline("{}"), + handler: "Dummy::handler", + }); + + const monitoring = new LambdaFunctionMonitoring(scope, { + lambdaFunction, + humanReadableName: "Dummy Lambda for testing", + alarmFriendlyName: "DummyLambda", + isIterator: false, + }); + + addMonitoringDashboardsToStack(stack, monitoring); + expect(Template.fromStack(stack)).toMatchSnapshot(); +}); + test("snapshot test: all alarms", () => { const stack = new Stack(); @@ -483,6 +506,36 @@ test("snapshot test: all alarms, alarmPrefix on latency dedupeString", () => { expect(Template.fromStack(stack)).toMatchSnapshot(); }); +test("throws error if attempting to create iterator age alarm if not an iterator", () => { + const stack = new Stack(); + + const scope = new TestMonitoringScope(stack, "Scope"); + + const lambdaFunction = new Function(stack, "Function", { + functionName: "DummyLambda", + runtime: Runtime.NODEJS_18_X, + code: InlineCode.fromInline("{}"), + handler: "Dummy::handler", + }); + + expect( + () => + new LambdaFunctionMonitoring(scope, { + lambdaFunction, + humanReadableName: "Dummy Lambda for testing", + alarmFriendlyName: "DummyLambda", + isIterator: false, + addMaxIteratorAgeAlarm: { + Warning: { + maxAgeInMillis: 1_000_000, + }, + }, + }), + ).toThrow( + "addMaxIteratorAgeAlarm is not applicable if isIterator is not true", + ); +}); + test("doesn't create alarms for enhanced Lambda Insights metrics if not enabled", () => { const stack = new Stack(); diff --git a/test/monitoring/aws-lambda/__snapshots__/LambdaFunctionMonitoring.test.ts.snap b/test/monitoring/aws-lambda/__snapshots__/LambdaFunctionMonitoring.test.ts.snap index aa6ea412..d987778e 100644 --- a/test/monitoring/aws-lambda/__snapshots__/LambdaFunctionMonitoring.test.ts.snap +++ b/test/monitoring/aws-lambda/__snapshots__/LambdaFunctionMonitoring.test.ts.snap @@ -3530,7 +3530,7 @@ Object { } `; -exports[`snapshot test: no alarms 1`] = ` +exports[`snapshot test: default iterator and no alarms 1`] = ` Object { "Parameters": Object { "BootstrapVersion": Object { @@ -3540,6 +3540,256 @@ Object { }, }, "Resources": Object { + "Alarm7103F465": Object { + "Properties": Object { + "DashboardBody": "{\\"widgets\\":[]}", + }, + "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": "nodejs18.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\\"}]],\\"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 (avg: \${AVG})\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90 (avg: \${AVG})\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99 (avg: \${AVG})\\",\\"stat\\":\\"p99\\"}]],\\"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)\\"}]],\\"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)\\"}]],\\"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\\"}]],\\"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\\"}]],\\"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\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, + "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\\"}]],\\"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 (avg: \${AVG})\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90 (avg: \${AVG})\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99 (avg: \${AVG})\\",\\"stat\\":\\"p99\\"}]],\\"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)\\"}]],\\"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: non-iterator and no alarms 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": "{\\"widgets\\":[]}", + }, + "Type": "AWS::CloudWatch::Dashboard", + }, "Function76856677": Object { "DependsOn": Array [ "FunctionServiceRole675BB04A", @@ -3591,6 +3841,144 @@ 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\\"}]],\\"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 (avg: \${AVG})\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90 (avg: \${AVG})\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99 (avg: \${AVG})\\",\\"stat\\":\\"p99\\"}]],\\"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)\\"}]],\\"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)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":12,\\"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\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":12,\\"height\\":5,\\"x\\":12,\\"y\\":6,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Errors\\",\\"region\\":\\"", + Object { + "Ref": "AWS::Region", + }, + "\\",\\"metrics\\":[[\\"AWS/Lambda\\",\\"Errors\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"Faults\\",\\"stat\\":\\"Sum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, + "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\\"}]],\\"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 (avg: \${AVG})\\",\\"stat\\":\\"p50\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P90 (avg: \${AVG})\\",\\"stat\\":\\"p90\\"}],[\\"AWS/Lambda\\",\\"Duration\\",\\"FunctionName\\",\\"", + Object { + "Ref": "Function76856677", + }, + "\\",{\\"label\\":\\"P99 (avg: \${AVG})\\",\\"stat\\":\\"p99\\"}]],\\"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)\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Rate\\",\\"showUnits\\":false}}}}]}", + ], + ], + }, + }, + "Type": "AWS::CloudWatch::Dashboard", + }, }, "Rules": Object { "CheckBootstrapVersion": Object {