Skip to content
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* [BUGFIX] Fix duplicate `other` in error messages for config. #4366
* [BUGFIX] Fix logic that considers an alert reopened in Jira. #4478
* [BUGFIX] Fix Jira issue count #4615
* [FEATURE] Add Multiple Sources support for Inhibition Rules. #4504
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding this to the 0.29 changelog? Shouldn't it be in the 0.31 draft?


## 0.28.1 / 2025-03-07

Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ inhibit_rules:
# the inhibition rule will apply!
equal: ['alertname']

# Multiple Sources can be defined when setting inhibitions.
# When all source matchers are matched, the inhibition is applied to
# the target alerts.

inhibit_rules:
- sources:
- matchers:
- alertname="instance_down"
- application="abc"
equal: ["cluster"]
- matchers:
- alertname="instance_down"
- application="xyz"
equal: ["severity"]
target_matchers:
- alertname="no_info"
- application="def"

receivers:
- name: 'team-X-mails'
Expand Down
8 changes: 8 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,11 @@ func (r *Route) UnmarshalYAML(unmarshal func(any) error) error {
return nil
}

type InhibitRuleSource struct {
SrcMatchers Matchers `yaml:"matchers,omitempty" json:"matchers,omitempty"`
Equal []string `yaml:"equal,omitempty" json:"equal,omitempty"`
}

// InhibitRule defines an inhibition rule that mutes alerts that match the
// target labels if an alert matching the source labels exists.
// Both alerts have to have a set of labels being equal.
Expand All @@ -1016,6 +1021,9 @@ type InhibitRule struct {
SourceMatchRE MatchRegexps `yaml:"source_match_re,omitempty" json:"source_match_re,omitempty"`
// SourceMatchers defines a set of label matchers that have to be fulfilled for source alerts.
SourceMatchers Matchers `yaml:"source_matchers,omitempty" json:"source_matchers,omitempty"`
// Sources defines a set of source matchers and equal labels for source alerts.
// All Source entries have to match for the inhibition to take effect.
Sources []InhibitRuleSource `yaml:"sources,omitempty" json:"sources,omitempty"`
// TargetMatch defines a set of labels that have to equal the given
// value for target alerts. Deprecated. Remove before v1.0 release.
TargetMatch map[string]string `yaml:"target_match,omitempty" json:"target_match,omitempty"`
Expand Down
Loading