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(autoscaling): can't use MathExpression in scaleOnMetric #5789

Merged
merged 3 commits into from
Jan 16, 2020

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jan 14, 2020


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

Commit Message

fix(autoscaling): can't use MathExpression in scaleOnMetric

It was not possible to use MathExpression objects in AutoScaling,
because the Alarm interface has a bug: it takes "override" arguments
like "period" and "statistic" that could and should have already been
encoded into the Metric object passed to the alarm.

Subsequently, AutoScaling used this ill-advised feature to force the
period of metrics to 1 minute. This caused an invalid render for math
expressions and was probably ill-advised to begin with. We should be
respecting the customer's period on the metric they pass in.

Fixes #5776.

BREAKING CHANGE: AutoScaling by using scaleOnMetric will no longer
force the alarm period to 1 minute, but use the period from the Metric
object instead (5 minutes by default). Use metric.with({ period: Duration.minute(1) }) to create a high-frequency scaling policy.

@rix0rrr rix0rrr self-assigned this Jan 14, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 14, 2020
It was not possible to use `MathExpression` objects in AutoScaling,
because the `Alarm` interface has a bug: it takes "override" arguments
like "period" and "statistic" that could and should have already been
encoded into the `Metric` object passed to the alarm.

Subsequently, AutoScaling used this ill-advised feature to force the
period of metrics to 1 minute. This caused an invalid render for math
expressions and was probably ill-advised to begin with. We should be
respecting the customer's period on the metric they pass in.

Fixes #5776.

BREAKING CHANGE: AutoScaling by using `scaleOnMetric` will no longer
force the alarm period to 1 minute, but use the period from the Metric
object instead (5 minutes by default). Use `metric.with({ period:
Duration.minute(1) })` to create a high-frequency scaling policy.
@rix0rrr rix0rrr force-pushed the huijbers/math-scaling branch from d66a7b7 to 1408ead Compare January 14, 2020 13:18
@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

@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

@@ -672,7 +678,7 @@ function changeAllPeriods(metrics: Record<string, IMetric>, period: cdk.Duration
* both implementations of IMetric have a `period` member that contains that particular
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit, is this doc paragraph still relevant?

@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

@mergify
Copy link
Contributor

mergify bot commented Jan 15, 2020

Thank you for contributing! Your pull request is now being automatically merged.

@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

@mergify
Copy link
Contributor

mergify bot commented Jan 16, 2020

Thank you for contributing! Your pull request is now being automatically merged.

@mergify mergify bot merged commit d4c1b0e into master Jan 16, 2020
@mergify mergify bot deleted the huijbers/math-scaling branch January 16, 2020 00:27
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.

AutoScalingGroup.scaleOnMetric with MathExpression as metric created invalid template
3 participants