From f0e4b69a85310b7853b60d8801631c59e8c4cc4d Mon Sep 17 00:00:00 2001 From: Rich Turner <7072278+richturner@users.noreply.github.com> Date: Wed, 2 Dec 2026 11:45:30 +0000 Subject: [PATCH] Reduce AttributeEventAlarm flapping after event rate changes Widen the anomaly detection band to 4 standard deviations and evaluate 15-minute periods, alarming on 3 of the last 4, so short bursts and a rate sitting near the band edge no longer flap the alarm. Both the upper and lower thresholds are kept. --- .ci_cd/aws/cloudformation-create-ec2.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.ci_cd/aws/cloudformation-create-ec2.yml b/.ci_cd/aws/cloudformation-create-ec2.yml index 91361dd95f..0ade514234 100644 --- a/.ci_cd/aws/cloudformation-create-ec2.yml +++ b/.ci_cd/aws/cloudformation-create-ec2.yml @@ -1389,12 +1389,15 @@ Resources: Type: AWS::CloudWatch::Alarm Condition: MetricsEnabled Properties: - AlarmDescription: Attribute event rate outside the expected band (3 standard deviations) for 2 of the last 3 5-minute periods + # A wider band and a longer window ride out short bursts and stop the alarm flapping when the rate sits near + # the band edge. A lasting step change (e.g. many devices added) still alarms until the model has adapted; to + # retrain sooner, exclude the time before the step from the detector's training (ExcludedTimeRanges) + AlarmDescription: Attribute event rate outside the expected band (4 standard deviations) for 3 of the last 4 15-minute periods ComparisonOperator: LessThanLowerOrGreaterThanUpperThreshold - EvaluationPeriods: 3 - DatapointsToAlarm: 2 + EvaluationPeriods: 4 + DatapointsToAlarm: 3 Metrics: - - Expression: ANOMALY_DETECTION_BAND(m1, 3) + - Expression: ANOMALY_DETECTION_BAND(m1, 4) Id: ad1 - Id: m1 MetricStat: @@ -1404,7 +1407,7 @@ Resources: Dimensions: - Name: InstanceName Value: !Ref Host - Period: 300 + Period: 900 Stat: Average ThresholdMetricId: ad1 TreatMissingData: breaching