Skip to content

Commit

Permalink
Fix filterRules failing when using preserveRecordingRules (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan authored Aug 15, 2023
1 parent 774ff84 commit 9b2f331
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/openshift4-monitoring-alert-patching.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,17 @@ local syn_team =
* is `false`, all recording rules are also removed from the result.
*/
local filterRules(group, ignoreNames=[], preserveRecordingRules=false) =
local filterRecording(rule) =
if preserveRecordingRules then
true
else
// only create duplicates of alert rules
std.objectHas(rule, 'alert');
local ignore_set = std.set(global_alert_params.ignoreNames + ignoreNames);
group {
rules:
std.filter(
// Filter out unwanted rules
function(rule)
filterRecording(rule) &&
!std.member(ignore_set, rule.alert),
local isAlert = std.objectHas(rule, 'alert');
if isAlert then
!std.member(ignore_set, rule.alert)
else
preserveRecordingRules,
super.rules
),
};
Expand Down

0 comments on commit 9b2f331

Please sign in to comment.