FIX: Do not key alerts on start time when calculating stale alerts

FIX: Do not key alerts on start time when calculating stale alerts

When running multiple alertmanagers in HA mode, the start time is not guaranteed to be consistent between instances.

diff --git a/app/jobs/regular/process_grouped_alerts.rb b/app/jobs/regular/process_grouped_alerts.rb
index 7f11622..1eec3fe 100644
--- a/app/jobs/regular/process_grouped_alerts.rb
+++ b/app/jobs/regular/process_grouped_alerts.rb
@@ -51,8 +51,7 @@ module Jobs
           alerts&.each do |alert|
             if alert['graph_url'].include?(graph_url) && is_firing?(alert['status'])
               is_stale = !current_alerts(data).any? do |current_alert|
-                current_alert['labels']['id'] == alert['id'] &&
-                  DateTime.parse(current_alert['startsAt']).to_s == DateTime.parse(alert['starts_at']).to_s
+                current_alert['labels']['id'] == alert['id']
               end
 
               if is_stale &&

GitHub sha: bf91d1c8

1 Like