Skip to content

Commit

Permalink
Allow matching on for field
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Feb 22, 2022
1 parent 594c952 commit f723538
Show file tree
Hide file tree
Showing 7 changed files with 1,979 additions and 206 deletions.
12 changes: 12 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## v0.14.0

### Added

- Allow matching alerting rules by `for` field - #148. Example:

```js
rule {
match {
for = ">= 10m"
}
}
```

### Changed

- Added `filename` label to `pint_problem` metric - #170.
Expand Down
15 changes: 15 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ rule {
label "(.*)" {
value = "(.*)"
}
for = "..."
}
match { ... }
match { ... }
Expand All @@ -182,6 +183,7 @@ rule {
label "(.*)" {
value = "(.*)"
}
for = "..."
}
ignore { ... }
ignore { ... }
Expand All @@ -203,6 +205,10 @@ rule {
- `match:label` - optional annotation filter, only rules with at least one label
matching this pattern will be checked by this rule. For recording rules only static
labels set on the recording rule are considered.
- `match:for` - optional alerting rule `for` filter. If set only alerting rules with `for`
field present and matching provided value will be checked by this rule. Recording rules
will never match it as they don't have `for` field.
Syntax is `OP DURATION` where `OP` can be any of `=`, `!=`, `>`, `>=`, `<`, `<=`.
- `ignore` - works exactly like `match` but does the opposite - any alerting or recording rule
matching all conditions defined on `ignore` will not be checked by this `rule` block.

Expand Down Expand Up @@ -239,3 +245,12 @@ rule {
[ check applied unless "watch" or "lint" command is run ]
}
```

```js
rule {
match {
for = ">= 5m"
}
[ check applied only to alerting rules with "for" field value that is >= 5m ]
}
```
Loading

0 comments on commit f723538

Please sign in to comment.