Skip to content

Commit

Permalink
Add capability to disable specific alert rules Loki (#11241)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:

Currently using the Loki Chart we can only either enable\disable ALL
alert rules.
For specific environments and use-cases sometimes not all alert Rules
are useful to have enabled.

With this PR change, we can cleanly and through the Chart values disable
specific Alerts.
  • Loading branch information
Daniel-Vaz authored Jan 17, 2024
1 parent bdcb695 commit dc1cb52
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2707,6 +2707,15 @@ true
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>monitoring.rules.disabled</td>
<td>object</td>
<td>If you disable all the alerts and keep .monitoring.rules.alerting set to true, the chart will fail to render.</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
Expand Down
5 changes: 5 additions & 0 deletions production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Entries should include a reference to the pull request that introduced the chang

[//]: # (<AUTOMATED_UPDATES_LOCATOR> : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.)


## 5.41.7

- [FEATURE] Add support to disable specific alert rules

## 5.41.6

- [BUGFIX] Added missing namespace to query-scheduler-discovery service when deploying loki in a specific namespace.
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: loki
description: Helm chart for Grafana Loki in simple, scalable mode
type: application
appVersion: 2.9.3
version: 5.41.6
version: 5.41.7
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# loki

![Version: 5.41.6](https://img.shields.io/badge/Version-5.41.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.3](https://img.shields.io/badge/AppVersion-2.9.3-informational?style=flat-square)
![Version: 5.41.7](https://img.shields.io/badge/Version-5.41.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.3](https://img.shields.io/badge/AppVersion-2.9.3-informational?style=flat-square)

Helm chart for Grafana Loki in simple, scalable mode

Expand Down
10 changes: 10 additions & 0 deletions production/helm/loki/src/alerts.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
groups:
- name: "loki_alerts"
rules:
{{- if not (.Values.monitoring.rules.disabled.LokiRequestErrors | default false) }}
- alert: "LokiRequestErrors"
annotations:
message: |
Expand All @@ -17,6 +18,8 @@ groups:
{{- if .Values.monitoring.rules.additionalRuleLabels }}
{{ toYaml .Values.monitoring.rules.additionalRuleLabels | indent 10 }}
{{- end }}
{{- end }}
{{- if not (.Values.monitoring.rules.disabled.LokiRequestPanics | default false) }}
- alert: "LokiRequestPanics"
annotations:
message: |
Expand All @@ -28,6 +31,8 @@ groups:
{{- if .Values.monitoring.rules.additionalRuleLabels }}
{{ toYaml .Values.monitoring.rules.additionalRuleLabels | indent 10 }}
{{- end }}
{{- end }}
{{- if not (.Values.monitoring.rules.disabled.LokiRequestLatency | default false) }}
- alert: "LokiRequestLatency"
annotations:
message: |
Expand All @@ -40,6 +45,8 @@ groups:
{{- if .Values.monitoring.rules.additionalRuleLabels }}
{{ toYaml .Values.monitoring.rules.additionalRuleLabels | indent 10 }}
{{- end }}
{{- end }}
{{- if not (.Values.monitoring.rules.disabled.LokiTooManyCompactorsRunning | default false) }}
- alert: "LokiTooManyCompactorsRunning"
annotations:
message: |
Expand All @@ -52,6 +59,8 @@ groups:
{{- if .Values.monitoring.rules.additionalRuleLabels }}
{{ toYaml .Values.monitoring.rules.additionalRuleLabels | indent 10 }}
{{- end }}
{{- end }}
{{- if not (.Values.monitoring.rules.disabled.LokiCanaryLatency | default false) }}
- name: "loki_canaries_alerts"
rules:
- alert: "LokiCanaryLatency"
Expand All @@ -66,3 +75,4 @@ groups:
{{- if .Values.monitoring.rules.additionalRuleLabels }}
{{ toYaml .Values.monitoring.rules.additionalRuleLabels | indent 10 }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,12 @@ monitoring:
enabled: true
# -- Include alerting rules
alerting: true
# -- Specify which individual alerts should be disabled
# -- Instead of turning off each alert one by one, set the .monitoring.rules.alerting value to false instead.
# -- If you disable all the alerts and keep .monitoring.rules.alerting set to true, the chart will fail to render.
disabled: {}
# LokiRequestErrors: true
# LokiRequestPanics: true
# -- Alternative namespace to create PrometheusRule resources in
namespace: null
# -- Additional annotations for the rules PrometheusRule resource
Expand Down

0 comments on commit dc1cb52

Please sign in to comment.