-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
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.
d66a7b7
to
1408ead
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
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 |
There was a problem hiding this comment.
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
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
inscaleOnMetric
It was not possible to use
MathExpression
objects in AutoScaling,because the
Alarm
interface has a bug: it takes "override" argumentslike "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 longerforce 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.