Skip to content

Commit e391785

Browse files
Eugene CheungEugene Cheung
authored andcommitted
feat!: require aws-cdk-lib ^2.160.0
This unfortunately drops the guard for non-serverless DatabaseClusters for Aurora monitoring since the constructs are now nearly indistinguishable based on their properties.
1 parent bacb2b1 commit e391785

File tree

13 files changed

+97
-580
lines changed

13 files changed

+97
-580
lines changed

.projen/deps.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projen/tasks.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "projen";
88
import { TrailingComma } from "projen/lib/javascript";
99

10-
const CDK_VERSION = "2.112.0";
10+
const CDK_VERSION = "2.160.0";
1111

1212
const project = new awscdk.AwsCdkConstructLibrary({
1313
name: "cdk-monitoring-constructs",
@@ -18,7 +18,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
1818
keywords: ["cloudwatch", "monitoring"],
1919

2020
defaultReleaseBranch: "main",
21-
majorVersion: 8,
21+
majorVersion: 9,
2222
stability: "experimental",
2323

2424
cdkVersion: CDK_VERSION,

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ In your `package.json`:
2626
```json
2727
{
2828
"dependencies": {
29-
"cdk-monitoring-constructs": "^7.0.0",
29+
"cdk-monitoring-constructs": "^9.0.0",
3030

3131
// peer dependencies of cdk-monitoring-constructs
32-
"aws-cdk-lib": "^2.112.0",
32+
"aws-cdk-lib": "^2.160.0",
3333
"constructs": "^10.0.5"
3434

3535
// ...your other dependencies...

lib/monitoring/aws-rds/AuroraClusterMonitoring.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
HorizontalAnnotation,
44
IWidget,
55
} from "aws-cdk-lib/aws-cloudwatch";
6-
import { ServerlessCluster } from "aws-cdk-lib/aws-rds";
76

87
import {
98
RdsClusterMetricFactory,
@@ -75,12 +74,6 @@ export class AuroraClusterMonitoring extends Monitoring {
7574
constructor(scope: MonitoringScope, props: AuroraClusterMonitoringProps) {
7675
super(scope, props);
7776

78-
if (!this.isServerlessCluster(props.cluster)) {
79-
throw Error(
80-
"Cluster is not of type `ServerlessCluster`. Monitoring is not applicable.",
81-
);
82-
}
83-
8477
const metricFactory = new RdsClusterMetricFactory(
8578
scope.createMetricFactory(),
8679
props,
@@ -164,10 +157,6 @@ export class AuroraClusterMonitoring extends Monitoring {
164157
props.useCreatedAlarms?.consume(this.createdAlarms());
165158
}
166159

167-
private isServerlessCluster(obj: any): obj is ServerlessCluster {
168-
return (obj as any).clusterArn !== undefined;
169-
}
170-
171160
summaryWidgets(): IWidget[] {
172161
return [
173162
this.createTitleWidget(),

package.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/dashboard/widget/__snapshots__/BitmapWidget.test.ts.snap

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/facade/__snapshots__/MonitoringAspect.test.ts.snap

Lines changed: 13 additions & 119 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/monitoring/aws-rds/AuroraClusterMonitoring.test.ts

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { Stack } from "aws-cdk-lib";
22
import { Template } from "aws-cdk-lib/assertions";
3-
import { InstanceType, SubnetType, Vpc } from "aws-cdk-lib/aws-ec2";
4-
import {
5-
AuroraMysqlEngineVersion,
6-
DatabaseCluster,
7-
DatabaseClusterEngine,
8-
ServerlessCluster,
9-
} from "aws-cdk-lib/aws-rds";
3+
import { DatabaseClusterEngine, ServerlessCluster } from "aws-cdk-lib/aws-rds";
104

115
import { AuroraClusterMonitoring } from "../../../lib";
126
import { addMonitoringDashboardsToStack } from "../../utils/SnapshotUtil";
@@ -31,58 +25,6 @@ test("snapshot test: no alarms", () => {
3125
expect(Template.fromStack(stack)).toMatchSnapshot();
3226
});
3327

34-
test("RDS passed into Aurora Cluster", () => {
35-
const testGuard = () => {
36-
const stack = new Stack();
37-
const scope = new TestMonitoringScope(stack, "Scope");
38-
const vpc = new Vpc(scope, "DummyVpc", {
39-
maxAzs: 3,
40-
});
41-
const rdsCluster = new DatabaseCluster(scope, "DummyRdsCluster", {
42-
engine: DatabaseClusterEngine.auroraMysql({
43-
version: AuroraMysqlEngineVersion.VER_2_07_10,
44-
}),
45-
instanceProps: {
46-
instanceType: new InstanceType("t3.small"),
47-
vpcSubnets: {
48-
subnetType: SubnetType.PUBLIC,
49-
},
50-
vpc,
51-
},
52-
});
53-
54-
new AuroraClusterMonitoring(scope, {
55-
alarmFriendlyName: "DummyAuroraCluster",
56-
cluster: rdsCluster,
57-
addCpuUsageAlarm: {
58-
Warning: {
59-
maxUsagePercent: 80,
60-
},
61-
},
62-
addMaxConnectionCountAlarm: {
63-
Warning: {
64-
maxConnectionCount: 100,
65-
},
66-
},
67-
addMinConnectionCountAlarm: {
68-
Warning: {
69-
minConnectionCount: 0,
70-
},
71-
},
72-
addMaxServerlessDatabaseCapacityAlarm: {
73-
Warning: {
74-
maxUsageCount: 100,
75-
},
76-
},
77-
});
78-
};
79-
80-
expect(testGuard).toThrow(Error);
81-
expect(testGuard).toThrow(
82-
"Cluster is not of type `ServerlessCluster`. Monitoring is not applicable.",
83-
);
84-
});
85-
8628
test("snapshot test: all alarms", () => {
8729
const stack = new Stack();
8830

0 commit comments

Comments
 (0)