cloudwatch: expression warning that when e
is present in the expression
#27932
Labels
@aws-cdk/aws-cloudwatch
Related to Amazon CloudWatch
bug
This issue is a bug.
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
effort/medium
Medium work item – several days of effort
p2
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Describe the bug
CDK is displaying a warning thinking
e
a metric. When using the math expression'serverError / (success + authError + clientError + serverError + 1e-36)'
(to avoid division by zero we are adding0.000000000000000000000000000000000001
)Expected Behavior
No warning
Current Behavior
[Warning at /IotStack/IoT-Connect-MQTT-ServerError1] Math expression 'serverError / (success + authError + clientError + serverError + 1e-36)' references unknown identifiers: e. Please add them to the 'usingMetrics' map. [ack: CloudWatch:Math:UnknownIdentifier]
Reproduction Steps
Simple error with no metric that always returns 0
outputs
[Warning at /IotStack-production/IoT-PublishOut-MQTT-AuthError4] Math expression '0 / 0 + 1e-36)' references unknown identifiers: e. Please add them to the 'usingMetrics' map. [ack: CloudWatch:Math:UnknownIdentifier]
Possible Solution
In https://github.com/ParkerVR/aws-cdk/blob/5daa6480fa2ebd8bfb2407d80b8df40c367ef8fd/packages/%40aws-cdk/aws-cloudwatch/lib/metric.ts#L749-L754 if identifier is
e
then it should be considered valid.This function is used https://github.com/ParkerVR/aws-cdk/blob/5daa6480fa2ebd8bfb2407d80b8df40c367ef8fd/packages/%40aws-cdk/aws-cloudwatch/lib/metric.ts#L610 to give the warning
Additional Information/Context
No response
CDK CLI Version
2.105.0 (build 04cb52d)
Framework Version
No response
Node.js Version
v18.18.0
OS
macOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: