-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add hasSourceTenantsForMetrics validator (#37)
* feat: add hasSourceTenantsForMetrics validator, refactor, optimize docs html rendering, add some additional tests Signed-off-by: Martin Chodur <[email protected]> * feat: additional things Signed-off-by: Martin Chodur <[email protected]> * refactor: expression helpers Signed-off-by: Martin Chodur <[email protected]> * chore: changelog Signed-off-by: Martin Chodur <[email protected]> --------- Signed-off-by: Martin Chodur <[email protected]>
- Loading branch information
Showing
26 changed files
with
608 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
<h1>Validation rules</h1> | ||
|
||
<h2><a href="#check-severity-label">check-severity-label</a></h2> | ||
<ul> | ||
<li>Alert has labels: <code>severity</code></li> | ||
<li>Alert label <code>severity</code> has one of the allowed values: <code>info</code>,<code>warning</code>,<code>critical</code></li> | ||
<li>Alert if rule has label <code>severity</code> with value <code>info</code> , it cannot have label <code>page</code></li> | ||
<li>Alert expression can be successfully evaluated on the live Prometheus instance</li> | ||
<li>Alert expression uses only labels that are actually present in Prometheus</li> | ||
<li>Alert expression selectors actually matches any series in Prometheus</li> | ||
<li>Alert expression does not use data older than <code>6h0m0s</code></li> | ||
</ul> | ||
|
||
<h2><a href="#check-team-label">check-team-label</a></h2> | ||
<ul> | ||
<li>Alert has labels: <code>xxx</code></li> | ||
<li>Alert label <code>team</code> has one of the allowed values: <code>[email protected]</code></li> | ||
</ul> | ||
|
||
<h2><a href="#check-playbook-annotation">check-playbook-annotation</a></h2> | ||
<ul> | ||
<li>Alert has any of these annotations: <code>playbook</code>,<code>link</code></li> | ||
<li>Alert Annotation <code>link</code> is a valid URL and does not return HTTP status 404</li> | ||
</ul> | ||
|
||
<h2><a href="#check-alert-title">check-alert-title</a></h2> | ||
<ul> | ||
<li>Alert has all of these annotations: <code>title</code></li> | ||
</ul> | ||
|
||
<h2><a href="#check-prometheus-limitations">check-prometheus-limitations</a></h2> | ||
<ul> | ||
<li>All rules expression does not use data older than <code>6h0m0s</code></li> | ||
<li>All rules does not use any of the <code>cluster</code>,<code>locality</code>,<code>prometheus-type</code>,<code>replica</code> labels is in its expression</li> | ||
</ul> | ||
|
||
<h2><a href="#check-source-tenants">check-source-tenants</a></h2> | ||
<ul> | ||
<li>All rules verifies if the rule group, the rule belongs to, has the required source_tenants configured, according to the mapping of metric names to tenants: <code>k8s</code>:<code>^container_.*|kube_.*$</code></li> | ||
</ul> | ||
|
||
<h2><a href="#check-metric-name">check-metric-name</a></h2> | ||
<ul> | ||
<li>Alert expression with no metric name</li> | ||
</ul> | ||
|
||
<h2><a href="#another-checks">another-checks</a></h2> | ||
<ul> | ||
<li>All rules labels does not have empty values</li> | ||
</ul> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
Validation rules: | ||
|
||
check-severity-label | ||
- Alert has labels: `severity` | ||
- Alert label `severity` has one of the allowed values: `info`,`warning`,`critical` | ||
- Alert if rule has label `severity` with value `info` , it cannot have label `page` | ||
- Alert expression can be successfully evaluated on the live Prometheus instance | ||
- Alert expression uses only labels that are actually present in Prometheus | ||
- Alert expression selectors actually matches any series in Prometheus | ||
- Alert expression does not use data older than `6h0m0s` | ||
|
||
check-team-label | ||
- Alert has labels: `xxx` | ||
- Alert label `team` has one of the allowed values: `[email protected]` | ||
|
||
check-playbook-annotation | ||
- Alert has any of these annotations: `playbook`,`link` | ||
- Alert Annotation `link` is a valid URL and does not return HTTP status 404 | ||
|
||
check-alert-title | ||
- Alert has all of these annotations: `title` | ||
|
||
check-prometheus-limitations | ||
- All rules expression does not use data older than `6h0m0s` | ||
- All rules does not use any of the `cluster`,`locality`,`prometheus-type`,`replica` labels is in its expression | ||
|
||
check-source-tenants | ||
- All rules verifies if the rule group, the rule belongs to, has the required source_tenants configured, according to the mapping of metric names to tenants: `k8s`:`^container_.*|kube_.*$` | ||
|
||
check-metric-name | ||
- Alert expression with no metric name | ||
|
||
another-checks | ||
- All rules labels does not have empty values | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.