-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cloudwatch: CDK detects false-positive missing identifiers on metric expressions #33591
Comments
…h:UnknownIdentifier warnings (aws#33591) Signed-off-by: Sergio García Prado <sergio@garciparedes.me>
…h:UnknownIdentifier warnings (aws#33591) Signed-off-by: Sergio García Prado <sergio@garciparedes.me>
…h:UnknownIdentifier warnings (aws#33591) Signed-off-by: Sergio García Prado <sergio@garciparedes.me>
Looking at the documentation for METRICS() function at Using math expressions with CloudWatch metrics, it mentions that: You can use the METRICS() function with a string to return only the graphed metrics that contain that string in their Id field. For example, the expression SUM(METRICS("errors")) returns a time series that is the sum of the values of all the graphed metrics that have ‘errors’ in their Id field. You can also use SUM([METRICS(“4xx”), METRICS(“5xx”)]) to match multiple strings. So the check at
|
…h:UnknownIdentifier warnings (aws#33591) Signed-off-by: Sergio García Prado <sergio@garciparedes.me>
…h:UnknownIdentifier warnings (aws#33591) Signed-off-by: Sergio García Prado <sergio@garciparedes.me>
Yeah, seems like there is a set of functions that can be used in the CloudWatch Metric expressions where partial identifiers are supported. |
Describe the bug
I have a metric
expression
defined asSUM(METRICS("prefix"))
where some of my metrics contains the"prefix"
string.When I synthetize the CDK, I started getting warning like this:
However, those are false-positives and should be skipped in the following line:
aws-cdk/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts
Line 710 in 6df9bfe
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Given that the
METRICS
operation accept part identifier names, it should not produce any warnings.Current Behavior
It produces warnings.
Reproduction Steps
Partially define a identifier in a
SUM(METRICS("partial"))
expression.Possible Solution
Update regular expression to properly handle the keywords that skip the warning:
Additional Information/Context
No response
CDK CLI Version
2.173.4
Framework Version
No response
Node.js Version
18
OS
OS X
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: