Class AlertCooldownManager

java.lang.Object
com.nmontytskyi.monitoring.server.alert.AlertCooldownManager

@Component public class AlertCooldownManager extends Object
In-memory cooldown tracker that prevents the same alert rule from firing repeatedly within its configured cooldown period.

For each rule the manager records the timestamp of the last firing. Before AlertEvaluationService creates a new AlertEventEntity it consults this component to verify the cooldown has elapsed. State is held in a ConcurrentHashMap and is therefore not persisted across server restarts — after a restart all rules fire on their next breach.

Author:
Nazar Montytskyi
See Also:
  • Constructor Details

    • AlertCooldownManager

      public AlertCooldownManager()
  • Method Details

    • isCooldownExpired

      public boolean isCooldownExpired(AlertRuleEntity rule)
      Returns true if the cooldown has expired (i.e., no recent event exists for the rule), meaning a new alert may be fired. Always reads from DB — no in-memory state.