question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cloudwatch metrics: expression warning too simplistic

See original GitHub issue

Describe the bug

CDK displays a warning for metrics expressions that are valid.

Specifically, it is trying to check that all variables used in the expression are defined, bit it does not deal with the SEARCH function, and likely not the METRICS either.

Expected Behavior

Not display a warning for valid expressions.

Current Behavior

Warning at /realtime-chime-meeting-local-997654549727-us-east-1-rjongbloed/Mon/Dash] Math expression '100 * SEARCH('{AWS/ApiGateway,ApiName,Method,Resource,Stage} ApiName=my-api MetricName=("4XXError" OR "5XXError")', 'Average', 60)' references unknown identifiers: piGateway, piName, ethod, esource, tage, piName, realtime, chime, meeting, local, rjongbloed, etricName, rror, rror, verage. Please add them to the 'usingMetrics' map.

Reproduction Steps

Create a metric using SEARCH function.

Possible Solution

  • Parse the complex expression including functions, quotes, parentheses etc.
  • Don’t do the check if the expression has “SEARCH” or “METRICS” in it.
  • Remove the warning completely.

Additional Information/Context

No response

CDK CLI Version

2.22.0 (build 1db4b16)

Framework Version

1.153.1

Node.js Version

v16.15.0

OS

MacOS

Language

Typescript, Python

Language Version

No response

Other information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:17
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Liteecommented, Nov 5, 2022

I would revert this feature, TBH. Its implementation did not take into account some scenarios.

1reaction
rpmcgintycommented, Dec 6, 2022

Hi, I see this issue has been assigned and the priority increased, but May 2022 was the last update. Is there a rough ETA for when this might be picked up?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using metric math - Amazon CloudWatch
Function Arguments Return type* Supported for cross‑account? ABS TS. TS TS. TS ✓ ANOMALY_DETECTION_BAND TS. TS, S TS AVG TS. TS S. TS ✓
Read more >
CloudWatch Metric Math: Tutorial With Examples - OpsRamp
AWS CloudWatch is a monitoring tool that collects the data from the utilization of the Instances like EMR, EC2, etc., in the form...
Read more >
Math Expression on AWS Cloudwatch metrics is not giving ...
I have created two metrics (m1 and m2) on my logs which will give me sum of some filter pattern, I wanted to...
Read more >
CloudWatch — Boto3 Docs 1.26.37 documentation
For all other expressions and metrics, set ReturnData to false . ... If ignore , the alarm state does not change during periods...
Read more >
AWS CloudWatch alerts vs. Dashbird alerts
Alerts will perform single or multiple actions based on the value of metric or expression which is relative to a threshold over a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found