Description
Support CustomWidget as a type of CloudWatch widget that can be inserted in Dashboard's.
Most of the logic for customizing a CustomWidget has to be in the lambda code, but I think this L2 would still provide some value by automatically generating the dashboard JSON for you - we currently do that by hand in our implementation of a custom widget as seen here: https://github.com/cdklabs/construct-hub/blob/4e63b8a78c505aafdd035c7ed5cc0c382921d64d/src/backend/inventory/package-versions-table-widget.ts#L44
Use Case
I think there could be some potential to build construct libraries that provide different useful custom widgets. Custom widgets seem decently flexible since they can contain HTML, SVG's, and buttons that invoke other lambda's.
Proposed Solution
The CustomWidget would be a type of CloudWatch widget that extends ConcreteWidget. It could be configured with a required Lambda parameter (which when invoked should return the the content to display in the dashboard), as well as parameters for when the widget should automatically update.
Other information
Docs reference: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard.html
Full custom widget definition (provided since the full definition syntax / options still need to be added to the AWS docs):
{
"height": 6,
"width": 12,
"y": 38,
"x": 0,
"type": "custom",
"properties": {
"title": "Sample: title",
"endpoint": "arn:aws:lambda:us-east-1:012345678901:function:customWidgetLambdaFunctionName",
"updateOn": {
"refresh": true,
"resize": false,
"timeRange": false
},
"params": {
"anything": "you-want",
"this is": [ "custom", "params" ],
"user-defined": true
}
}
}
Acknowledge
Description
Support
CustomWidgetas a type of CloudWatch widget that can be inserted inDashboard's.Most of the logic for customizing a
CustomWidgethas to be in the lambda code, but I think this L2 would still provide some value by automatically generating the dashboard JSON for you - we currently do that by hand in our implementation of a custom widget as seen here: https://github.com/cdklabs/construct-hub/blob/4e63b8a78c505aafdd035c7ed5cc0c382921d64d/src/backend/inventory/package-versions-table-widget.ts#L44Use Case
I think there could be some potential to build construct libraries that provide different useful custom widgets. Custom widgets seem decently flexible since they can contain HTML, SVG's, and buttons that invoke other lambda's.
Proposed Solution
The
CustomWidgetwould be a type of CloudWatch widget that extendsConcreteWidget. It could be configured with a required Lambda parameter (which when invoked should return the the content to display in the dashboard), as well as parameters for when the widget should automatically update.Other information
Docs reference: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard.html
Full custom widget definition (provided since the full definition syntax / options still need to be added to the AWS docs):
Acknowledge