Skip to content
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

(aws-cloudwatch): Error while creating a cloudwatch alarm with 10 metrics #27144

Closed
andreprawira opened this issue Sep 14, 2023 · 2 comments
Closed
Assignees
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. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@andreprawira
Copy link

Describe the bug

I'm trying to create a cloudwatch alarm using math expressions that contains more than 10 metrics but i'm seeing an error instead

Expected Behavior

expecting to create more than 10 individual metrics

Current Behavior

RuntimeError: Alarms on math expressions cannot contain more than 10 individual metrics error message

Reproduction Steps

math_expression = cw.MathExpression(
            label="test label",
            expression="IF(e9 OR e10, 1, 0)",
            using_metrics={
                "e9": rds_e9_metric,
                "e7": rds_e7_metric,
                "e2": rds_e2_metric,
                "m2": rds_m2_metric,
                "e3": rds_e3_metric,
                "m1": rds_m1_metric,             
                "e8": rds_e8_metric,
                "e5": rds_e5_metric,      
                "m5": rds_m5_metric,           
                "e10": rds_e10_metric,
                "e1": rds_e1_metric,
                "m3": rds_m3_metric,                
                "e6": rds_e6_metric,
                "m6": rds_m6_metric
            },
            period=cdk.Duration.minutes(5),
        )

this will cause the 10 individual metric error, any idea how to bypass it? seems like an unnecessary limitation

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.51.0 (build a87259f)

Framework Version

No response

Node.js Version

16.18.0

OS

Windows

Language

Python

Language Version

No response

Other information

No response

@andreprawira andreprawira added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 14, 2023
@github-actions github-actions bot added the @aws-cdk/aws-cloudwatch Related to Amazon CloudWatch label Sep 14, 2023
@khushail khushail changed the title (module name): (short issue description) (aws-cloudwatch): Error while creating a cloudwatch alarm with 10 metrics Sep 14, 2023
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 14, 2023
@khushail khushail self-assigned this Sep 14, 2023
@khushail
Copy link
Contributor

Hi @andreprawira , thanks for reaching out. Yes, its a limitation from our side as clearly indicated in the docs here.There are no direct solution to bypass this but you could try using multiple math expressions with distributed number of metrics.e.g 2 alarms with 5 metrics each. You could then use an EventBridge rule to trigger an action when either alarm goes into the ALARM state.

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Sep 15, 2023
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants