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

fix(cloudwatch): cross-account metrics in env-agnostic stack #5775

Merged
merged 2 commits into from
Jan 13, 2020

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jan 13, 2020

In order to avoid generating unnecessary diffs to currently-deployed
CloudWatch dashboards, in #5628 when adding support for
cross-region/cross-account metrics, we only selectively render the new
attributes into the graph (only when we estimate it will make a difference).

The method chosen was:

Render account/region if they're *definitely* different.

However, this has the side effect that the new region and account
attributes don't work at all in environment-agnostic stacks (because we
won't know whether they'll be different or not, and we assume they will
be).

Whether the original behavior was wrong or not can be debated,
but it's unintuitive for sure: users put in values that don't come
back out in the usual, getting-started case.

In this PR, change the decision to:

Don't render account/region if they're *definitely* the same.

This will fix the case of manual input to Metric, and since
attachTo() won't take account and region from environment-agnostic
stacks anyway, it also won't introduce unwanted diffs in most cases.

Fixes #5747.


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

In order to avoid generating unnecessary diffs to currently-deployed
CloudWatch dashboards, in #5628 when adding support for
cross-region/cross-account metrics, we only selectively render the new
attributes into the graph (only when we estimate it will make a difference).

The method chosen was:

    Render account/region if they're *definitely* different.

However, this has the side effect that the new region and account
attributes don't work at all in environment-agnostic stacks (because we
won't know whether they'll be different or not, and we assume they will
be).

Whether the original behavior was wrong or not can be debated,
but it's unintuitive for sure: users put in values that don't come
back out in the usual, getting-started case.

In this PR, change the decision to:

    Don't render account/region if they're *definitely* the same.

This will fix the case of manual input to `Metric`, and since
`attachTo()` won't take account and region from environment-agnostic
stacks anyway, it also won't introduce unwanted diffs in most cases.
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 13, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@rix0rrr rix0rrr merged commit 5292bd5 into master Jan 13, 2020
@rix0rrr rix0rrr deleted the huijbers/cw-region branch January 13, 2020 16:45
@rix0rrr rix0rrr mentioned this pull request Jan 15, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Key-value accountId in CloudWatch's Metric class not generated
3 participants