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

feat(cloudwatch): Support region and account in math expressions #9034

Closed
wants to merge 3 commits into from

Conversation

arnulfojr
Copy link
Contributor

@arnulfojr arnulfojr commented Jul 13, 2020

Adds support for MathExpressions to specify the region the metric is from

Closes #9039


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mergify
Copy link
Contributor

mergify bot commented Jul 13, 2020

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@arnulfojr arnulfojr changed the title Support regions and accounts in math expressions feat(cloudwatch) Support regions and accounts in math expressions Jul 13, 2020
@arnulfojr arnulfojr changed the title feat(cloudwatch) Support regions and accounts in math expressions feat(cloudwatch): Support regions and accounts in math expressions Jul 13, 2020
@arnulfojr arnulfojr changed the title feat(cloudwatch): Support regions and accounts in math expressions feat(cloudwatch): Support region and account in math expressions Jul 13, 2020
@arnulfojr arnulfojr changed the title feat(cloudwatch): Support region and account in math expressions fix(cloudwatch): Support region and account in math expressions Jul 13, 2020
@arnulfojr arnulfojr marked this pull request as ready for review July 13, 2020 14:16
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 1ef5d36
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@arnulfojr arnulfojr changed the title fix(cloudwatch): Support region and account in math expressions feat(cloudwatch): Support region and account in math expressions Jul 13, 2020
@ericzbeard ericzbeard requested review from rix0rrr and NetaNir July 15, 2020 01:55
@ericzbeard ericzbeard removed their assignment Jul 15, 2020
@ericzbeard ericzbeard removed their assignment Jul 17, 2020
@arnulfojr
Copy link
Contributor Author

@ericzbeard @SomayaB can we please agree for once who is the assignee(s)? :)

@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 11, 2020

I'd prefer this to be as implicit as possible. First of all, can you describe what the rules are we have to keep to? Do all metrics have to come from the same region and account?

If the math expression uses other metrics, I'd prefer if we automatically derived the account/region on the math expression. And validated it too, if that is required (if there are real metrics from different regions/accounts under a math expression, reject that early on if that is not allowed).

Does it come down to math expressions only requiring account/region if they do not use any other metrics to build the expression off of?

@NetaNir
Copy link
Contributor

NetaNir commented Nov 5, 2020

Im going to close this, please reopen when ready

@NetaNir NetaNir closed this Nov 5, 2020
mergify bot pushed a commit that referenced this pull request Sep 27, 2021
Fixes #9039 (also some prior discussion on #9034)

Currently CDK gives no way to specify account or region on MathExpressions which means it is not possible to run search expressions against environments other than the deployment environment.

The CloudWatch console currently has this capability, however [the documentation](https://docs.aws.amazon.com/en_us/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html#CloudWatch-Dashboard-Properties-Metric-Widget-Object) still states that `accountId` or `region` should only be used on metric widgets. I've left feedback to ask whether this documentation is out of date or whether it is an undocumented feature.

This change adds in the `searchAccount` and `searchRegion` property which can be optionally specified for the Dashboards use case. When a MathExpression with a searchAccount or searchRegion set is attempted to be used within an Alarm, the change throws an error as Alarms do not support search expressions.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
…6539)

Fixes aws#9039 (also some prior discussion on aws#9034)

Currently CDK gives no way to specify account or region on MathExpressions which means it is not possible to run search expressions against environments other than the deployment environment.

The CloudWatch console currently has this capability, however [the documentation](https://docs.aws.amazon.com/en_us/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html#CloudWatch-Dashboard-Properties-Metric-Widget-Object) still states that `accountId` or `region` should only be used on metric widgets. I've left feedback to ask whether this documentation is out of date or whether it is an undocumented feature.

This change adds in the `searchAccount` and `searchRegion` property which can be optionally specified for the Dashboards use case. When a MathExpression with a searchAccount or searchRegion set is attempted to be used within an Alarm, the change throws an error as Alarms do not support search expressions.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[aws-cloudwatch] Support region and account in MathExpression
5 participants