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): use string for DimensionHash #14978

Closed
wants to merge 2 commits into from

Conversation

cheruvian
Copy link
Contributor

The CloudWatch metric dimension object specifies that dimension values are strings.

This is caught at build time by the CDK which throws the following if you pass a numeric value as a dimension:

CfnSynthesisError: Resolution error: Supplied properties not correct for "CfnAlarmProps" 
  dimensions: element 0: supplied properties not correct for "DimensionProperty"
    value: 429 should be a string.

But we should catch it at dev time with the correct type hint


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

@gitpod-io
Copy link

gitpod-io bot commented Jun 3, 2021

@peterwoodworth peterwoodworth added the @aws-cdk/aws-cloudwatch Related to Amazon CloudWatch label Jun 3, 2021
The [CloudWatch metric dimension object specifies that dimension values are strings](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Dimension.html).

This is caught at build time by the CDK which throws the following if you pass a numeric value as a dimension:

```
CfnSynthesisError: Resolution error: Supplied properties not correct for "CfnAlarmProps"
  dimensions: element 0: supplied properties not correct for "DimensionProperty"
    value: 429 should be a string.
```

But we should catch it at dev time with the correct type hint
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 667952c
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@madeline-k
Copy link
Contributor

Hey @cheruvian thanks for your patience on this PR! After looking into this, I don't think it will be possible to change the DimensionHash type to support the kind of dev-time type-checking you want without introducing backwards compatibility and/or JSII compilation issues.

An alternative approach would be to introduce a new property with a new type, and deprecate this one. Here is a PR doing that - #15097, let me know what you think.

@madeline-k
Copy link
Contributor

Closing this PR in favor of PR #15097

@madeline-k madeline-k closed this Jun 14, 2021
mergify bot pushed a commit that referenced this pull request Jun 16, 2021
…ion values (#15097)

This is an alternative solution to  PR #14978 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
matthewsvu pushed a commit to matthewsvu/aws-cdk that referenced this pull request Jun 22, 2021
…ion values (aws#15097)

This is an alternative solution to  PR aws#14978 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…ion values (aws#15097)

This is an alternative solution to  PR aws#14978 

----

*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
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants