From a2b9445b44fe785804208e0ce5ede10895c413f7 Mon Sep 17 00:00:00 2001 From: Eugene Cheung <81188333+echeung-amzn@users.noreply.github.com> Date: Thu, 24 Mar 2022 22:43:30 -0400 Subject: [PATCH] chore: minor cleanup (#84) Some minor updates pulled out from #83 cf. commit messages for exact changes --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_ --- API.md | 3 +- lib/common/alarm/AlarmFactory.ts | 3 +- .../SecretsManagerMetricsPublisher.ts | 6 +- test/facade/MonitoringAspect.test.ts | 2 +- .../MonitoringAspect.test.ts.snap | 74 +++++++++---------- .../OpenSearchClusterMonitoring.test.ts | 8 +- .../OpenSearchClusterMonitoring.test.ts.snap | 64 ++++++++-------- ...ecretsManagerSecretMonitoring.test.ts.snap | 6 +- 8 files changed, 83 insertions(+), 83 deletions(-) diff --git a/API.md b/API.md index 8b2e067d..70d76a6c 100644 --- a/API.md +++ b/API.md @@ -2703,11 +2703,10 @@ public readonly action: IAlarmActionStrategy; ``` - *Type:* IAlarmActionStrategy +- *Default:* no action. Default alarm action used for each alarm, unless it is overridden. -If you do not want any actions to be created, just use NoAlarmActionStrategy. - --- ##### `annotationStrategy`Optional diff --git a/lib/common/alarm/AlarmFactory.ts b/lib/common/alarm/AlarmFactory.ts index a20fcd6e..e0f15c8f 100644 --- a/lib/common/alarm/AlarmFactory.ts +++ b/lib/common/alarm/AlarmFactory.ts @@ -336,7 +336,8 @@ export interface AlarmFactoryDefaults { /** * Default alarm action used for each alarm, unless it is overridden. - * If you do not want any actions to be created, just use NoAlarmActionStrategy. + * + * @default no action. */ readonly action?: IAlarmActionStrategy; diff --git a/lib/monitoring/aws-secretsmanager/SecretsManagerMetricsPublisher.ts b/lib/monitoring/aws-secretsmanager/SecretsManagerMetricsPublisher.ts index 70d0e869..571c9ba7 100644 --- a/lib/monitoring/aws-secretsmanager/SecretsManagerMetricsPublisher.ts +++ b/lib/monitoring/aws-secretsmanager/SecretsManagerMetricsPublisher.ts @@ -1,6 +1,6 @@ import * as path from "path"; -import { Construct, Duration } from "monocdk"; +import { Construct, Duration, Names } from "monocdk"; import { Rule, RuleTargetInput, Schedule } from "monocdk/aws-events"; import { LambdaFunction } from "monocdk/aws-events-targets"; import { Effect, PolicyStatement } from "monocdk/aws-iam"; @@ -60,7 +60,7 @@ export class SecretsManagerMetricsPublisher extends Construct { } static getInstance(scope: MonitoringScope) { - const key = scope.node.uniqueId; + const key = Names.nodeUniqueId(scope.node); let instance = SecretsManagerMetricsPublisher.instances[key]; if (!instance) { instance = new SecretsManagerMetricsPublisher(scope); @@ -72,7 +72,7 @@ export class SecretsManagerMetricsPublisher extends Construct { addSecret(secret: ISecret): void { // run 1/hr so alarms can recover automatically - const rule = new Rule(this, `RuleFor${secret.node.id}`, { + const rule = new Rule(this, `RuleFor${Names.nodeUniqueId(secret.node)}`, { schedule: Schedule.cron({ minute: "0", }), diff --git a/test/facade/MonitoringAspect.test.ts b/test/facade/MonitoringAspect.test.ts index c5ebfdc6..1a07b419 100644 --- a/test/facade/MonitoringAspect.test.ts +++ b/test/facade/MonitoringAspect.test.ts @@ -378,7 +378,7 @@ describe("MonitoringAspect", () => { const facade = createDummyMonitoringFacade(stack); new opensearch.Domain(stack, "DummyOSDomain", { - domainName: "DummyOSDomain", + domainName: "dummy-os-domain", version: opensearch.EngineVersion.ELASTICSEARCH_7_10, }); new elasticsearch.Domain(stack, "DummyESDomain", { diff --git a/test/facade/__snapshots__/MonitoringAspect.test.ts.snap b/test/facade/__snapshots__/MonitoringAspect.test.ts.snap index bc9c78c2..ecf031c2 100644 --- a/test/facade/__snapshots__/MonitoringAspect.test.ts.snap +++ b/test/facade/__snapshots__/MonitoringAspect.test.ts.snap @@ -3818,7 +3818,7 @@ Object { Object { "Ref": "AWS::Region", }, - "#domain:resource=DummyOSDomain;action=dashboard;tab=TAB_CLUSTER_HEALTH_ID_V2)**\\"}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":0,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", + "#domain:resource=dummy-os-domain;action=dashboard;tab=TAB_CLUSTER_HEALTH_ID_V2)**\\"}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":0,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -3826,7 +3826,7 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Indexing Latency\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":6,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Indexing Latency\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -3834,15 +3834,15 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/ES\\",\\"IndexingLatency\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/ES\\",\\"IndexingLatency\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/ES\\",\\"IndexingLatency\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/ES\\",\\"IndexingLatency\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Search Latency\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":12,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Search Latency\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -3850,15 +3850,15 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/ES\\",\\"SearchLatency\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/ES\\",\\"SearchLatency\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/ES\\",\\"SearchLatency\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/ES\\",\\"SearchLatency\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Node Count\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":5,\\"x\\":18,\\"y\\":12,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Node Count\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -3866,7 +3866,7 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"Nodes\\",\\"stat\\":\\"Minimum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":0,\\"y\\":17,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"CPU/Memory/Disk Usage\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"Nodes\\",\\"stat\\":\\"Minimum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":0,\\"y\\":17,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"CPU/Memory/Disk Usage\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -3874,19 +3874,19 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"CPU Usage\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"JVMMemoryPressure\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"CPU Usage\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"JVMMemoryPressure\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"JVM Memory Pressure\\",\\"stat\\":\\"Maximum\\"}],[{\\"label\\":\\"Disk Usage\\",\\"expression\\":\\"100 * (used/(used+free))\\"}],[\\"AWS/ES\\",\\"ClusterUsedSpace\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"JVM Memory Pressure\\",\\"stat\\":\\"Maximum\\"}],[{\\"label\\":\\"Disk Usage\\",\\"expression\\":\\"100 * (used/(used+free))\\"}],[\\"AWS/ES\\",\\"ClusterUsedSpace\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"used\\"}],[\\"AWS/ES\\",\\"FreeStorageSpace\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"used\\"}],[\\"AWS/ES\\",\\"FreeStorageSpace\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"free\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":17,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Master CPU/Memory Usage\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"free\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":8,\\"y\\":17,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Master CPU/Memory Usage\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -3894,11 +3894,11 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"Master CPU Usage\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"MasterJVMMemoryPressure\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"Master CPU Usage\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"MasterJVMMemoryPressure\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"Master JVM Memory Pressure\\",\\"stat\\":\\"Maximum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":17,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Index/Snapshot/KMS Errors\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"Master JVM Memory Pressure\\",\\"stat\\":\\"Maximum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":8,\\"height\\":5,\\"x\\":16,\\"y\\":17,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Index/Snapshot/KMS Errors\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -3906,19 +3906,19 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"Index Writes Blocked\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"AutomatedSnapshotFailure\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"Index Writes Blocked\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"AutomatedSnapshotFailure\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"Automated Snapshot Failures\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"KMSKeyError\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"Automated Snapshot Failures\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"KMSKeyError\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"KMS Key Error\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"KMSKeyInaccessible\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"KMS Key Error\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"KMSKeyInaccessible\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"KMS Key Inaccessible\\",\\"stat\\":\\"Maximum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":22,\\"properties\\":{\\"markdown\\":\\"### Elasticsearch Domain **[DummyESDomain](https://", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"KMS Key Inaccessible\\",\\"stat\\":\\"Maximum\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":22,\\"properties\\":{\\"markdown\\":\\"### Elasticsearch Domain **[DummyESDomain](https://", Object { "Ref": "AWS::Region", }, @@ -4364,7 +4364,7 @@ Object { Object { "Ref": "AWS::Region", }, - "#domain:resource=DummyOSDomain;action=dashboard;tab=TAB_CLUSTER_HEALTH_ID_V2)**\\"}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":6,\\"x\\":0,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", + "#domain:resource=dummy-os-domain;action=dashboard;tab=TAB_CLUSTER_HEALTH_ID_V2)**\\"}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":6,\\"x\\":0,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"TPS\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -4372,7 +4372,7 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":6,\\"x\\":6,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Indexing Latency\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"requests\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"Count\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":6,\\"x\\":6,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Indexing Latency\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -4380,15 +4380,15 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/ES\\",\\"IndexingLatency\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/ES\\",\\"IndexingLatency\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/ES\\",\\"IndexingLatency\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/ES\\",\\"IndexingLatency\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":6,\\"x\\":12,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Search Latency\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":6,\\"x\\":12,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"Search Latency\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -4396,15 +4396,15 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/ES\\",\\"SearchLatency\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P50\\",\\"stat\\":\\"p50\\"}],[\\"AWS/ES\\",\\"SearchLatency\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/ES\\",\\"SearchLatency\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P90\\",\\"stat\\":\\"p90\\"}],[\\"AWS/ES\\",\\"SearchLatency\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":6,\\"x\\":18,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"CPU/Memory/Disk Usage\\",\\"region\\":\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"P99\\",\\"stat\\":\\"p99\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"label\\":\\"ms\\",\\"showUnits\\":false}}}},{\\"type\\":\\"metric\\",\\"width\\":6,\\"height\\":6,\\"x\\":18,\\"y\\":8,\\"properties\\":{\\"view\\":\\"timeSeries\\",\\"title\\":\\"CPU/Memory/Disk Usage\\",\\"region\\":\\"", Object { "Ref": "AWS::Region", }, @@ -4412,27 +4412,27 @@ Object { Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"CPU Usage\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"MasterCPUUtilization\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"CPU Usage\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"MasterCPUUtilization\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"Master CPU Usage\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"JVMMemoryPressure\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"Master CPU Usage\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"JVMMemoryPressure\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"JVM Memory Pressure\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"MasterJVMMemoryPressure\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"JVM Memory Pressure\\",\\"stat\\":\\"Maximum\\"}],[\\"AWS/ES\\",\\"MasterJVMMemoryPressure\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"label\\":\\"Master JVM Memory Pressure\\",\\"stat\\":\\"Maximum\\"}],[{\\"label\\":\\"Disk Usage\\",\\"expression\\":\\"100 * (used/(used+free))\\"}],[\\"AWS/ES\\",\\"ClusterUsedSpace\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"label\\":\\"Master JVM Memory Pressure\\",\\"stat\\":\\"Maximum\\"}],[{\\"label\\":\\"Disk Usage\\",\\"expression\\":\\"100 * (used/(used+free))\\"}],[\\"AWS/ES\\",\\"ClusterUsedSpace\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"used\\"}],[\\"AWS/ES\\",\\"FreeStorageSpace\\",\\"ClientId\\",\\"", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"used\\"}],[\\"AWS/ES\\",\\"FreeStorageSpace\\",\\"ClientId\\",\\"", Object { "Ref": "AWS::AccountId", }, - "\\",\\"DomainName\\",\\"DummyOSDomain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"free\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":14,\\"properties\\":{\\"markdown\\":\\"### Elasticsearch Domain **[DummyESDomain](https://", + "\\",\\"DomainName\\",\\"dummy-os-domain\\",{\\"stat\\":\\"Sum\\",\\"visible\\":false,\\"id\\":\\"free\\"}]],\\"yAxis\\":{\\"left\\":{\\"min\\":0,\\"max\\":100,\\"label\\":\\"%\\",\\"showUnits\\":false}}}},{\\"type\\":\\"text\\",\\"width\\":24,\\"height\\":1,\\"x\\":0,\\"y\\":14,\\"properties\\":{\\"markdown\\":\\"### Elasticsearch Domain **[DummyESDomain](https://", Object { "Ref": "AWS::Region", }, @@ -4697,7 +4697,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "DummyOSDomain", + "DomainName": "dummy-os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -5419,7 +5419,7 @@ Object { }, "Type": "AWS::IAM::Policy", }, - "MonitoringFacadeSecretsManagerMetricsPublisherRuleForSecretAllowEventRuleMonitoringFacadeSecretsManagerMetricsPublisherLambda629BCAEF738371FA": Object { + "MonitoringFacadeSecretsManagerMetricsPublisherRuleForDummyDBClusterSecretD1842629AllowEventRuleMonitoringFacadeSecretsManagerMetricsPublisherLambda629BCAEF0F3129A8": Object { "Properties": Object { "Action": "lambda:InvokeFunction", "FunctionName": Object { @@ -5431,14 +5431,14 @@ Object { "Principal": "events.amazonaws.com", "SourceArn": Object { "Fn::GetAtt": Array [ - "MonitoringFacadeSecretsManagerMetricsPublisherRuleForSecretCD702A49", + "MonitoringFacadeSecretsManagerMetricsPublisherRuleForDummyDBClusterSecretD1842629B7399DC7", "Arn", ], }, }, "Type": "AWS::Lambda::Permission", }, - "MonitoringFacadeSecretsManagerMetricsPublisherRuleForSecretCD702A49": Object { + "MonitoringFacadeSecretsManagerMetricsPublisherRuleForDummyDBClusterSecretD1842629B7399DC7": Object { "Properties": Object { "ScheduleExpression": "cron(0 * * * ? *)", "State": "ENABLED", diff --git a/test/monitoring/aws-opensearch/OpenSearchClusterMonitoring.test.ts b/test/monitoring/aws-opensearch/OpenSearchClusterMonitoring.test.ts index e864785b..c8d5fafd 100644 --- a/test/monitoring/aws-opensearch/OpenSearchClusterMonitoring.test.ts +++ b/test/monitoring/aws-opensearch/OpenSearchClusterMonitoring.test.ts @@ -13,17 +13,17 @@ import { TestMonitoringScope } from "../TestMonitoringScope"; const stack = new Stack(); [ new elasticsearch.CfnDomain(stack, "ElasticsearchCfnDomain", { - domainName: "ElasticsearchCfnDomain", + domainName: "es-cfn-domain", }), new elasticsearch.Domain(stack, "ElasticsearchDomain", { - domainName: "ElasticsearchDomain", + domainName: "es-domain", version: elasticsearch.ElasticsearchVersion.V7_7, }), new opensearch.CfnDomain(stack, "OpenSearchCfnDomain", { - domainName: "OpenSearchCfnDomain", + domainName: "os-cfn-domain", }), new opensearch.Domain(stack, "OpenSearchDomain", { - domainName: "OpenSearchDomain", + domainName: "os-domain", version: opensearch.EngineVersion.OPENSEARCH_1_0, }), ].forEach((domain) => { diff --git a/test/monitoring/aws-opensearch/__snapshots__/OpenSearchClusterMonitoring.test.ts.snap b/test/monitoring/aws-opensearch/__snapshots__/OpenSearchClusterMonitoring.test.ts.snap index b7a7c68d..4d4d25ed 100644 --- a/test/monitoring/aws-opensearch/__snapshots__/OpenSearchClusterMonitoring.test.ts.snap +++ b/test/monitoring/aws-opensearch/__snapshots__/OpenSearchClusterMonitoring.test.ts.snap @@ -5,7 +5,7 @@ Object { "Resources": Object { "ElasticsearchCfnDomain": Object { "Properties": Object { - "DomainName": "ElasticsearchCfnDomain", + "DomainName": "es-cfn-domain", }, "Type": "AWS::Elasticsearch::Domain", }, @@ -19,7 +19,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "ElasticsearchDomain", + "DomainName": "es-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -45,7 +45,7 @@ Object { }, "OpenSearchCfnDomain": Object { "Properties": Object { - "DomainName": "OpenSearchCfnDomain", + "DomainName": "os-cfn-domain", }, "Type": "AWS::OpenSearchService::Domain", }, @@ -65,7 +65,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "OpenSearchDomain", + "DomainName": "os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -92,7 +92,7 @@ Object { "Resources": Object { "ElasticsearchCfnDomain": Object { "Properties": Object { - "DomainName": "ElasticsearchCfnDomain", + "DomainName": "es-cfn-domain", }, "Type": "AWS::Elasticsearch::Domain", }, @@ -106,7 +106,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "ElasticsearchDomain", + "DomainName": "es-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -132,7 +132,7 @@ Object { }, "OpenSearchCfnDomain": Object { "Properties": Object { - "DomainName": "OpenSearchCfnDomain", + "DomainName": "os-cfn-domain", }, "Type": "AWS::OpenSearchService::Domain", }, @@ -152,7 +152,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "OpenSearchDomain", + "DomainName": "os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -179,7 +179,7 @@ Object { "Resources": Object { "ElasticsearchCfnDomain": Object { "Properties": Object { - "DomainName": "ElasticsearchCfnDomain", + "DomainName": "es-cfn-domain", }, "Type": "AWS::Elasticsearch::Domain", }, @@ -193,7 +193,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "ElasticsearchDomain", + "DomainName": "es-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -219,7 +219,7 @@ Object { }, "OpenSearchCfnDomain": Object { "Properties": Object { - "DomainName": "OpenSearchCfnDomain", + "DomainName": "os-cfn-domain", }, "Type": "AWS::OpenSearchService::Domain", }, @@ -239,7 +239,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "OpenSearchDomain", + "DomainName": "os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -266,7 +266,7 @@ Object { "Resources": Object { "ElasticsearchCfnDomain": Object { "Properties": Object { - "DomainName": "ElasticsearchCfnDomain", + "DomainName": "es-cfn-domain", }, "Type": "AWS::Elasticsearch::Domain", }, @@ -280,7 +280,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "ElasticsearchDomain", + "DomainName": "es-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -306,7 +306,7 @@ Object { }, "OpenSearchCfnDomain": Object { "Properties": Object { - "DomainName": "OpenSearchCfnDomain", + "DomainName": "os-cfn-domain", }, "Type": "AWS::OpenSearchService::Domain", }, @@ -326,7 +326,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "OpenSearchDomain", + "DomainName": "os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -353,7 +353,7 @@ Object { "Resources": Object { "ElasticsearchCfnDomain": Object { "Properties": Object { - "DomainName": "ElasticsearchCfnDomain", + "DomainName": "es-cfn-domain", }, "Type": "AWS::Elasticsearch::Domain", }, @@ -367,7 +367,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "ElasticsearchDomain", + "DomainName": "es-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -393,7 +393,7 @@ Object { }, "OpenSearchCfnDomain": Object { "Properties": Object { - "DomainName": "OpenSearchCfnDomain", + "DomainName": "os-cfn-domain", }, "Type": "AWS::OpenSearchService::Domain", }, @@ -413,7 +413,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "OpenSearchDomain", + "DomainName": "os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -440,7 +440,7 @@ Object { "Resources": Object { "ElasticsearchCfnDomain": Object { "Properties": Object { - "DomainName": "ElasticsearchCfnDomain", + "DomainName": "es-cfn-domain", }, "Type": "AWS::Elasticsearch::Domain", }, @@ -454,7 +454,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "ElasticsearchDomain", + "DomainName": "es-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -480,7 +480,7 @@ Object { }, "OpenSearchCfnDomain": Object { "Properties": Object { - "DomainName": "OpenSearchCfnDomain", + "DomainName": "os-cfn-domain", }, "Type": "AWS::OpenSearchService::Domain", }, @@ -500,7 +500,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "OpenSearchDomain", + "DomainName": "os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -527,7 +527,7 @@ Object { "Resources": Object { "ElasticsearchCfnDomain": Object { "Properties": Object { - "DomainName": "ElasticsearchCfnDomain", + "DomainName": "es-cfn-domain", }, "Type": "AWS::Elasticsearch::Domain", }, @@ -541,7 +541,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "ElasticsearchDomain", + "DomainName": "es-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -567,7 +567,7 @@ Object { }, "OpenSearchCfnDomain": Object { "Properties": Object { - "DomainName": "OpenSearchCfnDomain", + "DomainName": "os-cfn-domain", }, "Type": "AWS::OpenSearchService::Domain", }, @@ -587,7 +587,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "OpenSearchDomain", + "DomainName": "os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -614,7 +614,7 @@ Object { "Resources": Object { "ElasticsearchCfnDomain": Object { "Properties": Object { - "DomainName": "ElasticsearchCfnDomain", + "DomainName": "es-cfn-domain", }, "Type": "AWS::Elasticsearch::Domain", }, @@ -628,7 +628,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "ElasticsearchDomain", + "DomainName": "es-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, @@ -654,7 +654,7 @@ Object { }, "OpenSearchCfnDomain": Object { "Properties": Object { - "DomainName": "OpenSearchCfnDomain", + "DomainName": "os-cfn-domain", }, "Type": "AWS::OpenSearchService::Domain", }, @@ -674,7 +674,7 @@ Object { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07", }, - "DomainName": "OpenSearchDomain", + "DomainName": "os-domain", "EBSOptions": Object { "EBSEnabled": true, "VolumeSize": 10, diff --git a/test/monitoring/aws-secretsmanager/__snapshots__/SecretsManagerSecretMonitoring.test.ts.snap b/test/monitoring/aws-secretsmanager/__snapshots__/SecretsManagerSecretMonitoring.test.ts.snap index 02ba9732..80e3091d 100644 --- a/test/monitoring/aws-secretsmanager/__snapshots__/SecretsManagerSecretMonitoring.test.ts.snap +++ b/test/monitoring/aws-secretsmanager/__snapshots__/SecretsManagerSecretMonitoring.test.ts.snap @@ -282,7 +282,7 @@ Object { }, "Type": "AWS::IAM::Role", }, - "ScopeSecretsManagerMetricsPublisherRuleForSecret1A5D12B4E": Object { + "ScopeSecretsManagerMetricsPublisherRuleForStack1Secret175B2D0483CD4B237": Object { "Properties": Object { "ScheduleExpression": "cron(0 * * * ? *)", "State": "ENABLED", @@ -312,7 +312,7 @@ Object { }, "Type": "AWS::Events::Rule", }, - "ScopeSecretsManagerMetricsPublisherRuleForSecret1AllowEventRuleStack1ScopeSecretsManagerMetricsPublisherLambda436901E8FB7C2A5E": Object { + "ScopeSecretsManagerMetricsPublisherRuleForStack1Secret175B2D048AllowEventRuleStack1ScopeSecretsManagerMetricsPublisherLambda436901E8F52F91E8": Object { "Properties": Object { "Action": "lambda:InvokeFunction", "FunctionName": Object { @@ -324,7 +324,7 @@ Object { "Principal": "events.amazonaws.com", "SourceArn": Object { "Fn::GetAtt": Array [ - "ScopeSecretsManagerMetricsPublisherRuleForSecret1A5D12B4E", + "ScopeSecretsManagerMetricsPublisherRuleForStack1Secret175B2D0483CD4B237", "Arn", ], },