Skip to content

Commit

Permalink
Move alerts to sep file
Browse files Browse the repository at this point in the history
  • Loading branch information
v-zhuravlev committed Nov 16, 2023
1 parent 8eae54f commit 1d1dda9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
23 changes: 23 additions & 0 deletions docs/macos-observ-lib/alerts.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
new(this, parentPrometheus):
{
groups:
//keep only alerts listed in alertsMacKeep
std.filter(
function(group) std.length(group.rules) > 0,
[
{
name: group.name,
rules: [
rule
for rule in group.rules
if std.length(std.find(rule.alert, this.config.alertsMacKeep)) > 0
],
}
for group in parentPrometheus.alerts.groups
],

),

},
}
19 changes: 2 additions & 17 deletions docs/macos-observ-lib/main.libsonnet
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local alerts = import './alerts.libsonnet';
local config = import './config.libsonnet';
local g = import './g.libsonnet';
local panels = import './panels.libsonnet';
Expand Down Expand Up @@ -48,23 +49,7 @@ nodelib
},
prometheus+: {
recordingRules: {},
alerts:
{
groups:
[
{
name: group.name,
rules: [
rule
for rule in group.rules
if std.length(std.find(rule.alert, this.config.alertsMacKeep)) > 0
],
}
for group in parentPrometheus.alerts.groups
],

},

alerts: alerts.new(this, parentPrometheus),
},
},

Expand Down

0 comments on commit 1d1dda9

Please sign in to comment.