Skip to content

Commit

Permalink
Merge pull request grafana/cortex-jsonnet#347 from grafana/ruler-alerts
Browse files Browse the repository at this point in the history
Replace ruler alerts, and add playbooks.
  • Loading branch information
pracucci authored Jul 2, 2021
2 parents d876f21 + a815207 commit 5cd7ca0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
30 changes: 25 additions & 5 deletions jsonnet/mimir-mixin/alerts/alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -512,20 +512,40 @@
name: 'ruler_alerts',
rules: [
{
alert: 'CortexRulerFailedEvaluations',
alert: 'CortexRulerTooManyFailedPushes',
expr: |||
sum by (%s, instance, rule_group) (rate(cortex_prometheus_rule_evaluation_failures_total[1m]))
100 * (
sum by (%s, instance) (rate(cortex_ruler_write_requests_failed_total[1m]))
/
sum by (%s, instance, rule_group) (rate(cortex_prometheus_rule_evaluations_total[1m]))
> 0.01
sum by (%s, instance) (rate(cortex_ruler_write_requests_total[1m]))
) > 1
||| % [$._config.alert_aggregation_labels, $._config.alert_aggregation_labels],
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
message: |||
Cortex Ruler {{ $labels.instance }} is experiencing {{ printf "%.2f" $value }}% write (push) errors.
|||,
},
},
{
alert: 'CortexRulerTooManyFailedQueries',
expr: |||
100 * (
sum by (%s, instance) (rate(cortex_ruler_queries_failed_total[1m]))
/
sum by (%s, instance) (rate(cortex_ruler_queries_total[1m]))
) > 1
||| % [$._config.alert_aggregation_labels, $._config.alert_aggregation_labels],
'for': '5m',
labels: {
severity: 'warning',
},
annotations: {
message: |||
Cortex Ruler {{ $labels.instance }} is experiencing {{ printf "%.2f" $value }}% errors for the rule group {{ $labels.rule_group }}.
Cortex Ruler {{ $labels.instance }} is experiencing {{ printf "%.2f" $value }}% errors while evaluating rules.
|||,
},
},
Expand Down
21 changes: 19 additions & 2 deletions jsonnet/mimir-mixin/docs/playbooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,26 @@ More information:

This alert occurs when a ruler is unable to validate whether or not it should claim ownership over the evaluation of a rule group. The most likely cause is that one of the rule ring entries is unhealthy. If this is the case proceed to the ring admin http page and forget the unhealth ruler. The other possible cause would be an error returned the ring client. If this is the case look into debugging the ring based on the in-use backend implementation.

### CortexRulerFailedEvaluations
### CortexRulerTooManyFailedPushes

_TODO: this playbook has not been written yet._
This alert fires when rulers cannot push new samples (result of rule evaluation) to ingesters.

In general, pushing samples can fail due to problems with Cortex operations (eg. too many ingesters have crashed, and ruler cannot write samples to them), or due to problems with resulting data (eg. user hitting limit for number of series, out of order samples, etc.).
This alert fires only for first kind of problems, and not for problems caused by limits or invalid rules.

How to **fix**:
- Investigate the ruler logs to find out the reason why ruler cannot write samples. Note that ruler logs all push errors, including "user errors", but those are not causing the alert to fire. Focus on problems with ingesters.

### CortexRulerTooManyFailedQueries

This alert fires when rulers fail to evaluate rule queries.

Each rule evaluation may fail due to many reasons, eg. due to invalid PromQL expression, or query hits limits on number of chunks. These are "user errors", and this alert ignores them.

There is a category of errors that is more important: errors due to failure to read data from store-gateways or ingesters. These errors would result in 500 when run from querier. This alert fires if there is too many of such failures.

How to **fix**:
- Investigate the ruler logs to find out the reason why ruler cannot evaluate queries. Note that ruler logs rule evaluation errors even for "user errors", but those are not causing the alert to fire. Focus on problems with ingesters or store-gateways.

### CortexRulerMissedEvaluations

Expand Down

0 comments on commit 5cd7ca0

Please sign in to comment.