Description
Hi Team,
Currently GraphWidget only takes IMetric object in its 'Left' property array. and IMetric can only take MathExpression or Metric object. There is no support for SEARCH Expression in it.
Reference : https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudwatch.GraphWidget.html
https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudwatch.IMetric.html
While working on dashboard I realized we do need to have SEARCH option enabled for GraphWidget in order to create dashboard properly.
Sample Use Case: Lets say you have a Fargate service where under your Cluster there are X number of Task running.
Now to have a graph on lets say Heap Used, we need one SEARCH Expression on 'Cluster Name' so that it will show Heap Usage for all the available Tasks under that Cluster.
Currently with CDK , you can't really get each TaskIds (as it will be generated at runtime) and that in turns will restrict you to create a METRIC expression with ClusterName and List.
So we really need to enable GraphWidget to take 'SEARCH Expression'.
Metric Expression is yet to be supported in CDK, #4942 #5261
do let me know if we already have some workaround