-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cloudwatch): add verticalAnnotations property to GraphWidget
Adds a verticalAnnotation property to GraphWidget, reference: https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html#CloudWatch-Dashboard-Properties-Annotation-Format Shoutout to brendo-m for coming up with the solution Closes #7622.
- Loading branch information
Saruul Shafiq
committed
Aug 21, 2023
1 parent
00a7f03
commit 372fa84
Showing
12 changed files
with
593 additions
and
6 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...nnotations.js.snapshot/DashboardWithGraphWidgetWithAnnotationsIntegrationTest.assets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"version": "30.0.0", | ||
"files": { | ||
"fa0b1fe0c3043238b7413b794c626bac246c94f150aa6e3ff441a030d7dce521": { | ||
"source": { | ||
"path": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-current_region": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", | ||
"objectKey": "fa0b1fe0c3043238b7413b794c626bac246c94f150aa6e3ff441a030d7dce521.json", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
55 changes: 55 additions & 0 deletions
55
...otations.js.snapshot/DashboardWithGraphWidgetWithAnnotationsIntegrationTest.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"Resources": { | ||
"DashCCD7F836": { | ||
"Type": "AWS::CloudWatch::Dashboard", | ||
"Properties": { | ||
"DashboardBody": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":0,\"properties\":{\"view\":\"timeSeries\",\"title\":\"My fancy graph\",\"region\":\"", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
"\",\"metrics\":[[\"CDK/Test\",\"Metric\",{\"label\":\"Metric left 1 - p99\",\"stat\":\"p99\"}],[\"CDK/Test\",\"Metric\",{\"label\":\"Metric left 2 - TC_10P_90P\",\"stat\":\"TC(10%:90%)\"}],[\"CDK/Test\",\"Metric\",{\"label\":\"Metric left 3 - TS(5%:95%)\",\"stat\":\"TS(5%:95%)\"}],[\"CDK/Test\",\"Metric\",{\"label\":\"Metric right 1 - p90.1234\",\"stat\":\"p90.1234\",\"yAxis\":\"right\"}]],\"annotations\":{\"horizontal\":[{\"value\":10,\"label\":\"Left annotation\",\"color\":\"#00ff00\",\"fill\":\"above\",\"visible\":true,\"yAxis\":\"left\"},{\"value\":20,\"label\":\"Right annotation\",\"color\":\"#e30d0d\",\"fill\":\"below\",\"visible\":false,\"yAxis\":\"right\"}],\"vertical\":[{\"value\":\"2023-08-20T00:00:00.000Z\",\"label\":\"Vertical annotation\",\"color\":\"#2556f6\",\"fill\":\"after\",\"visible\":true}]},\"yAxis\":{}}}]}" | ||
] | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-annotations.js.snapshot/cdk.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"30.0.0"} |
19 changes: 19 additions & 0 deletions
19
...dkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74.assets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"version": "30.0.0", | ||
"files": { | ||
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { | ||
"source": { | ||
"path": "cdkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-current_region": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", | ||
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
36 changes: 36 additions & 0 deletions
36
...integdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...-cloudwatch/test/integ.dashboard-with-graphwidget-with-annotations.js.snapshot/integ.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": "30.0.0", | ||
"testCases": { | ||
"cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest": { | ||
"stacks": [ | ||
"DashboardWithGraphWidgetWithAnnotationsIntegrationTest" | ||
], | ||
"assertionStack": "cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest/DeployAssert", | ||
"assertionStackName": "cdkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74" | ||
} | ||
} | ||
} |
111 changes: 111 additions & 0 deletions
111
...oudwatch/test/integ.dashboard-with-graphwidget-with-annotations.js.snapshot/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ | ||
"version": "30.0.0", | ||
"artifacts": { | ||
"DashboardWithGraphWidgetWithAnnotationsIntegrationTest.assets": { | ||
"type": "cdk:asset-manifest", | ||
"properties": { | ||
"file": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest.assets.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"DashboardWithGraphWidgetWithAnnotationsIntegrationTest": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest.template.json", | ||
"validateOnSynth": false, | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", | ||
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", | ||
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fa0b1fe0c3043238b7413b794c626bac246c94f150aa6e3ff441a030d7dce521.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", | ||
"additionalDependencies": [ | ||
"DashboardWithGraphWidgetWithAnnotationsIntegrationTest.assets" | ||
], | ||
"lookupRole": { | ||
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", | ||
"requiresBootstrapStackVersion": 8, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"dependencies": [ | ||
"DashboardWithGraphWidgetWithAnnotationsIntegrationTest.assets" | ||
], | ||
"metadata": { | ||
"/DashboardWithGraphWidgetWithAnnotationsIntegrationTest/Dash/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "DashCCD7F836" | ||
} | ||
], | ||
"/DashboardWithGraphWidgetWithAnnotationsIntegrationTest/BootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "BootstrapVersion" | ||
} | ||
], | ||
"/DashboardWithGraphWidgetWithAnnotationsIntegrationTest/CheckBootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "CheckBootstrapVersion" | ||
} | ||
] | ||
}, | ||
"displayName": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest" | ||
}, | ||
"cdkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74.assets": { | ||
"type": "cdk:asset-manifest", | ||
"properties": { | ||
"file": "cdkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74.assets.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"cdkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "cdkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74.template.json", | ||
"validateOnSynth": false, | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", | ||
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", | ||
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", | ||
"additionalDependencies": [ | ||
"cdkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74.assets" | ||
], | ||
"lookupRole": { | ||
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", | ||
"requiresBootstrapStackVersion": 8, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"dependencies": [ | ||
"cdkintegdashboardwithgraphwidgetwithannotationsDefaultTestDeployAssertD4707D74.assets" | ||
], | ||
"metadata": { | ||
"/cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest/DeployAssert/BootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "BootstrapVersion" | ||
} | ||
], | ||
"/cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest/DeployAssert/CheckBootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "CheckBootstrapVersion" | ||
} | ||
] | ||
}, | ||
"displayName": "cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest/DeployAssert" | ||
}, | ||
"Tree": { | ||
"type": "cdk:tree", | ||
"properties": { | ||
"file": "tree.json" | ||
} | ||
} | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
...s-cloudwatch/test/integ.dashboard-with-graphwidget-with-annotations.js.snapshot/tree.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
{ | ||
"version": "tree-0.1", | ||
"tree": { | ||
"id": "App", | ||
"path": "", | ||
"children": { | ||
"DashboardWithGraphWidgetWithAnnotationsIntegrationTest": { | ||
"id": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest", | ||
"path": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest", | ||
"children": { | ||
"Dash": { | ||
"id": "Dash", | ||
"path": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest/Dash", | ||
"children": { | ||
"Resource": { | ||
"id": "Resource", | ||
"path": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest/Dash/Resource", | ||
"attributes": { | ||
"aws:cdk:cloudformation:type": "AWS::CloudWatch::Dashboard", | ||
"aws:cdk:cloudformation:props": { | ||
"dashboardBody": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":0,\"properties\":{\"view\":\"timeSeries\",\"title\":\"My fancy graph\",\"region\":\"", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
"\",\"metrics\":[[\"CDK/Test\",\"Metric\",{\"label\":\"Metric left 1 - p99\",\"stat\":\"p99\"}],[\"CDK/Test\",\"Metric\",{\"label\":\"Metric left 2 - TC_10P_90P\",\"stat\":\"TC(10%:90%)\"}],[\"CDK/Test\",\"Metric\",{\"label\":\"Metric left 3 - TS(5%:95%)\",\"stat\":\"TS(5%:95%)\"}],[\"CDK/Test\",\"Metric\",{\"label\":\"Metric right 1 - p90.1234\",\"stat\":\"p90.1234\",\"yAxis\":\"right\"}]],\"annotations\":{\"horizontal\":[{\"value\":10,\"label\":\"Left annotation\",\"color\":\"#00ff00\",\"fill\":\"above\",\"visible\":true,\"yAxis\":\"left\"},{\"value\":20,\"label\":\"Right annotation\",\"color\":\"#e30d0d\",\"fill\":\"below\",\"visible\":false,\"yAxis\":\"right\"}],\"vertical\":[{\"value\":\"2023-08-20T00:00:00.000Z\",\"label\":\"Vertical annotation\",\"color\":\"#2556f6\",\"fill\":\"after\",\"visible\":true}]},\"yAxis\":{}}}]}" | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-cloudwatch.CfnDashboard", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-cloudwatch.Dashboard", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"BootstrapVersion": { | ||
"id": "BootstrapVersion", | ||
"path": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest/BootstrapVersion", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.CfnParameter", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"CheckBootstrapVersion": { | ||
"id": "CheckBootstrapVersion", | ||
"path": "DashboardWithGraphWidgetWithAnnotationsIntegrationTest/CheckBootstrapVersion", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.CfnRule", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Stack", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"cdk-integ-dashboard-with-graph-widget-with-annotations": { | ||
"id": "cdk-integ-dashboard-with-graph-widget-with-annotations", | ||
"path": "cdk-integ-dashboard-with-graph-widget-with-annotations", | ||
"children": { | ||
"DefaultTest": { | ||
"id": "DefaultTest", | ||
"path": "cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest", | ||
"children": { | ||
"Default": { | ||
"id": "Default", | ||
"path": "cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest/Default", | ||
"constructInfo": { | ||
"fqn": "constructs.Construct", | ||
"version": "10.1.252" | ||
} | ||
}, | ||
"DeployAssert": { | ||
"id": "DeployAssert", | ||
"path": "cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest/DeployAssert", | ||
"children": { | ||
"BootstrapVersion": { | ||
"id": "BootstrapVersion", | ||
"path": "cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest/DeployAssert/BootstrapVersion", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.CfnParameter", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"CheckBootstrapVersion": { | ||
"id": "CheckBootstrapVersion", | ||
"path": "cdk-integ-dashboard-with-graph-widget-with-annotations/DefaultTest/DeployAssert/CheckBootstrapVersion", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.CfnRule", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Stack", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/integ-tests.IntegTestCase", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/integ-tests.IntegTest", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"Tree": { | ||
"id": "Tree", | ||
"path": "Tree", | ||
"constructInfo": { | ||
"fqn": "constructs.Construct", | ||
"version": "10.1.252" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.App", | ||
"version": "0.0.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.