Skip to content

Conversation

@iankhou
Copy link
Contributor

@iankhou iankhou commented Aug 26, 2025

Issue #35262

Closes #35262.

Reason for this change

YAxisProps indicated a default value of 0 for min, and No maximum value for max. This does not hold true for any class that uses this property.

If the default value of 0 for min were true, then omitting it should produce the same behavior in graphs as if min: 0 were assigned. This is not the case. See cdklabs/construct-hub#1775 for a counterexample.

AlarmWidget

The default is no minimum or maximum for the y-axis, as we do NOT pass min and max by default.

GaugeWidget

The default is 0 as the min and 100 as the max.

GraphWidget

Here, we do NOT pass min and max by default, and they are automatically configured in CloudWatch if not provided.

Description of changes

Corrected the @default to "Auto" for both min and max. Simplified the logic for passing YAxisProps in GaugeWidget, as there was previously dead code.

Describe any new or updated permissions being added

None.

Description of how you validated changes

Ran unit tests, which have sufficient coverage for the change to GaugeWidget.

No testing needed for documentation change.

Checklist


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

@github-actions github-actions bot added the p2 label Aug 26, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team August 26, 2025 18:49
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 26, 2025
@github-actions github-actions bot added the effort/small Small work item – less than a day of effort label Aug 26, 2025
@iankhou iankhou self-assigned this Aug 26, 2025
@iankhou iankhou marked this pull request as ready for review August 26, 2025 18:55
metrics: metrics.length > 0 ? metrics : undefined,
annotations: (this.props.annotations ?? []).length > 0 ? { horizontal: this.props.annotations } : undefined,
yAxis: {
left: leftYAxis ?? undefined,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined here is dead code.

@mergify
Copy link
Contributor

mergify bot commented Aug 27, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Aug 27, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 2558c4d into main Aug 27, 2025
19 checks passed
@mergify mergify bot deleted the iankhou-cw-yaxis branch August 27, 2025 08:08
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloudwatch: min property @default 0 should be Auto instead

3 participants