Oreon IT Helm charts / slo-burn-rate-alerts

slo-burn-rate-alerts Helm chart

Version 0.3.3 · app 0.3.0 · MIT · source · Artifact Hub

Write your SLOs as Helm values and get, for each one:

No operator, no CRD of its own, no binary to run. It renders a PrometheusRule and a ConfigMap, which is what most teams end up hand-writing after reading the workbook chapter. Works with kube-prometheus-stack out of the box.

Install

helm repo add oreonit https://oreondev.github.io/helm-charts
helm repo update
helm install slo oreonit/slo-burn-rate-alerts -n monitoring -f my-slos.yaml

my-slos.yaml:

prometheusRule:
  labels:
    release: kube-prometheus-stack   # whatever your Prometheus ruleSelector expects

slos:
  - name: api-availability
    service: api
    objective: 99.9
    description: non-5xx responses over all responses
    sli:
      errorQuery: sum(rate(http_requests_total{job="api",code=~"5.."}[$WINDOW]))
      totalQuery: sum(rate(http_requests_total{job="api"}[$WINDOW]))

  - name: api-latency-300ms
    service: api
    objective: 95
    sli:
      errorQuery: sum(rate(http_request_duration_seconds_count{job="api"}[$WINDOW])) - sum(rate(http_request_duration_seconds_bucket{job="api",le="0.3"}[$WINDOW]))
      totalQuery: sum(rate(http_request_duration_seconds_count{job="api"}[$WINDOW]))
    alerting:
      page:
        enabled: false        # latency only opens tickets

Write $WINDOW wherever the range selector goes. The chart substitutes it for every window it needs (5m, 30m, 1h, 2h, 6h, 1d, 3d and the SLO period, 30d by default). errorQuery / totalQuery must be the share of bad events.

What gets generated

For an SLO called api-availability with objective 99.9 (budget 0.001):

Metric Meaning
slo:sli_error:ratio_rate<window>{slo="api-availability"} bad / total over <window>
slo:error_budget_burn_rate:ratio_rate<window> error ratio divided by the budget (1 = burning exactly the budget)
slo:objective:ratio 0.999
slo:error_budget:ratio 0.001
slo:period:days 30
slo:error_budget_remaining:ratio 1 - (error ratio over the period / budget); negative once the budget is spent

Alerts (names configurable with alerting.alertNamePrefix):

Alert Fires when Default severity for
SLOBurnRatePage burn rate > 14.4 on both 1h and 5m, or > 6 on both 6h and 30m critical 2m
SLOBurnRateTicket burn rate > 3 on both 1d and 2h, or > 1 on both 3d and 6h warning 15m

Both carry the labels slo, service, slo_alert_type (page/ticket), the SLO's own labels and alerting.labels, so routing in Alertmanager is one matcher.

Why these numbers: a burn rate of 14.4 on a 30-day SLO spends 2 % of the budget in an hour and the whole budget in about two days, which is worth a page. A burn rate of 1 spends exactly the budget and only deserves a ticket. The short window stops the alert from staying open long after the problem is fixed. If your period is not 30 days, set sloPeriodDays and recompute factor = period_hours x budget_fraction / long_window_hours in alerting.*.windows.

Values

Key Default Description
sloPeriodDays 30 SLO window in days
rulesBackend prometheus-operator prometheus-operator (PrometheusRule) or gmp (Google Managed Prometheus rules)
gmp.kind ClusterRules Rules, ClusterRules or GlobalRules when rulesBackend: gmp
prometheusRule.enabled true Render the rules object
prometheusRule.namespace release namespace Where to put it
prometheusRule.labels {} Labels for the Prometheus Operator ruleSelector
prometheusRule.interval 30s Rule group evaluation interval
dashboard.enabled true Render the dashboard ConfigMap
dashboard.labels grafana_dashboard: "1" Label the Grafana sidecar watches
dashboard.annotations {} e.g. grafana_folder: SLOs
alerting.alertNamePrefix SLO Alert name prefix
alerting.labels / annotations {} Added to every alert
alerting.page.*, alerting.ticket.* see values.yaml enabled, severity, for, windows
slos[] [] name, service, objective, description, labels, sli.errorQuery, sli.totalQuery, alerting overrides
openslo [] OpenSLO v1 SLO / SLI documents, as a list or one multi-document YAML string (see below)

Per-SLO alerting.page / alerting.ticket may override enabled, severity and for; alerting.annotations adds annotations (a runbook_url per SLO is the usual one).

OpenSLO input

SLOs already written in OpenSLO v1 (for Sloth, Nobl9 or your own tooling) can go in unchanged, as a list under openslo or as a file:

helm install slo oreonit/slo-burn-rate-alerts -n monitoring --set-file openslo=slos.yaml
apiVersion: openslo/v1
kind: SLO
metadata:
  name: checkout-availability
  labels:
    team: payments
spec:
  service: checkout
  budgetingMethod: Occurrences
  timeWindow:
    - duration: 30d
      isRolling: true
  objectives:
    - targetPercent: 99.9
  indicator:
    metadata:
      name: checkout-errors
    spec:
      ratioMetric:
        counter: true
        bad:
          metricSource:
            type: Prometheus
            spec:
              query: sum(rate(http_requests_total{job="checkout",code=~"5.."}[{{.window}}]))
        total:
          metricSource:
            type: Prometheus
            spec:
              query: http_requests_total{job="checkout"}

Each SLO becomes the same rules, alerts and dashboard rows as an entry in slos, and both lists can be used together.

OpenSLO How the chart reads it
metadata.name, metadata.labels the slo label and extra labels (list values are joined with commas)
spec.service, spec.description the service label and the description
objectives[0].target / targetPercent the objective
ratioMetric.bad + total errors / total
ratioMetric.good + total (total − good) / total
indicatorRef a kind: SLI document in the same list
query range $WINDOW or {{.window}} filled in for every window
a plain counter selector with counter: true becomes sum(rate(<selector>[window]))

Not supported, and the render fails with the reason rather than producing rules that measure something else: Timeslices and RatioTimeslices budgeting, thresholdMetric, ratioMetric.raw, more than one objective, non-Prometheus metric sources, and a timeWindow other than sloPeriodDays (30d; 28d or 4w with sloPeriodDays: 28). alertPolicies are ignored: the burn-rate alerts come from the chart's alerting values.

Google Managed Prometheus (GKE managed collection)

Managed collection does not read PrometheusRule. Set rulesBackend: gmp and the chart renders the same groups as a ClusterRules object (monitoring.googleapis.com/v1) that the managed rule evaluator loads by itself:

rulesBackend: gmp
gmp:
  kind: ClusterRules      # or Rules (one namespace) / GlobalRules (whole project)

Alerts are sent to the Alertmanager named in the OperatorConfig (gmp-public/config); the dashboard works unchanged against the Managed Service for Prometheus data source in Grafana.

Dashboard

Imported by the kube-prometheus-stack Grafana sidecar as SLO overview and burn rates (uid oreon-slo-overview). It has a data-source variable and an SLO variable fed from slo:objective:ratio, so it needs no editing. If you do not run the sidecar, kubectl get cm <release>-slo-burn-rate-alerts-dashboard -o jsonpath='{.data.slo-overview\.json}' gives you the JSON to import by hand.

Notes and limits

Background reading: how multi-window burn-rate alerts work and 12 SLO and SLI examples with PromQL. If you want the SLOs defined with you rather than by you, that is what our SRE consulting does.

Licence

MIT. Maintained by Oreon IT.

Oreon IT

Maintained by Oreon IT

A London cloud, DevOps and SRE consultancy. If you want this chart rolled out and tuned for your platform, we can help.