-
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
[aws-cloudwatch] Missing ThresholdMetricId #10540
Comments
Hello, I'm working on a fix for this now, a PR should be open shortly. |
Absolute legend! Thanks @rrhodes 😄 |
This will be my first contribution to CDK, so bear with me, I suspect regular contributors will have valuable feedback for me. :) |
In the meantime, If you really need this feature you can configure it using escape hatch: const anomalyDetectionExp = new cloudwatch.MathExpression({
expression: 'ANOMALY_DETECTION_BAND(m1,2)',
usingMetrics: {
m1: metricA,
},
label: 'Anomaly detection',
period: cdk.Duration.minutes(1),
});
const alarm = anomalyDetectionExp.createAlarm(this, 'MyAlarm', {
evaluationPeriods: 1,
threshold: 5, // dummy value will be removed below
comparisonOperator: ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
});
const cfnAlarm = alarm.node.defaultChild as CfnAlarm;
cfnAlarm.addPropertyDeletionOverride('Threshold');
(alarm.node.defaultChild as CfnAlarm).thresholdMetricId = 'expr_1'; // The id will always be 'expr_1' if there is one expression |
An L2 solution for this problem remains outstanding. Initial work to embed support for threshold metric IDs into the existing @NetaNir suggested the following, which I agree would be the best approach at this time:
|
any update so far? |
Is this still both p1 and in progress? Sounds like the preferred approach is a factory function that produces an |
👋 A status update on this would be highly appreciated! |
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Hi, I see that a patch is in progress, any update on it ? Got the exact same problem with this code : const alarm = new cloudwatch.Alarm(this, 'Alarm', {
alarmName: 'Alarm',
actionsEnabled: true,
metric: new Metric({
namespace: 'AWS/ApiGateway',
metricName: 'Count',
dimensions: {
'ApiName': 'The API',
'Resource': '/an/endpoint',
'Stage': 'prod',
'Method': 'GET'
},
statistic: 'Sum'
}),
comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_LOWER_THRESHOLD,
threshold: 1,
evaluationPeriods: 1,
datapointsToAlarm: 1,
treatMissingData: cloudwatch.TreatMissingData.BREACHING
}); |
Allows customers to create Alarms with anomaly detection enabled. Supports both direct metrics and math expressions. Closes aws#10540
Is there any hope for this? |
I'm willing to contribute this but would like to have context of what's left to align on so we can have few back and forwards on the PR. |
Is this being worked upon? |
Any update on this? |
Run into this issue trying to use .monitorBilling() from |
To give a cocurrently working example using escape hatch:
|
This also gets triggered by |
When creating Cloudwatch Alarm that makes use of anomaly detection the following error is raised at deploy time:
Reproduction Steps
The Alarm construct works great for any of the other ComparisonOperators that do not rely on anomaly detection i.e.
GreaterThanThreshold
.Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: