Skip to content

Conversation

@SaladDay
Copy link
Contributor

What type of PR is this?

feature

What this PR does / why we need it:

This PR implements support for default notify configurations in alert notification rules.

currently, when an alert is triggered, if none of the notify configs match the alert's conditions (severity, time range, etc.), no notification is sent. This can lead to missed alerts in edge cases.

This PR adds an IsDefault field to NotifyConfig, allowing users to designate one config as a fallback. The new logic works as follows:

  1. Try to match all non-default notify configs first
  2. If no match is found, fall back to the default config(s)
  3. Log an error if still no config matches

This ensures critical alerts are neevr silently dropped due to misconfigured matching rules.

Which issue(s) this PR fixes:

Fixes #2871

@710leo
Copy link
Member

710leo commented Oct 17, 2025

@SaladDay This PR could use a tiny bit of polishing :)
1.Consider avoiding assigning anonymous functions, as this can affect readability.
2.For the default notification rule, from a product design perspective, only allow the last notification rule to be set as the default configuration; this removes the need for complex conditional logic.

@SaladDay
Copy link
Contributor Author

Hi @710leo,
Thanks for your valuable suggestions! I've updated the PR to address the points you raised:

  1. Refactored the anonymous function into a named method.
  2. Simplified the design for the default notification rule:
    • Added validation logic to ensure only the last notification rule can be set as the default (enforced in models/notify_rule.go).
    • Removed the more complex defaultIndexes loop logic.

Thanks again for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants