No alerts

# This example shows a simple service level by implementing a single SLO without alerts.
# It disables page (critical) and ticket (warning) alerts.
# The SLO SLI measures the event errors as the http request respones with the code >=500 and 429.
#
# `sloth generate -i ./examples/no-alerts.yml`
#
version: "prometheus/v1"
service: "myapp"
labels:
  owner: "myteam"
slos:
  - name: "http-availability"
    objective: 99.99
    description: "Common SLO based on availability for HTTP request responses."
    sli:
      events:
        error_query: |
          sum(
            rate(http_request_duration_seconds_count{job="myapp", code=~"(5..|429)"}[{{.window}}])
          )
        total_query: |
          sum(
            rate(http_request_duration_seconds_count{job="myapp"}[{{.window}}])
          )
    alerting:
      page_alert:
        disable: true
      ticket_alert:
        disable: true
---
# Code generated by Sloth (dev): https://github.com/slok/sloth.
# DO NOT EDIT.

groups:
- name: sloth-slo-sli-recordings-myapp-http-availability
  rules:
  - record: slo:sli_error:ratio_rate5m
    expr: |
      (sum(
        rate(http_request_duration_seconds_count{job="myapp", code=~"(5..|429)"}[5m])
      )
      )
      /
      (sum(
        rate(http_request_duration_seconds_count{job="myapp"}[5m])
      )
      )
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_window: 5m
  - record: slo:sli_error:ratio_rate30m
    expr: |
      (sum(
        rate(http_request_duration_seconds_count{job="myapp", code=~"(5..|429)"}[30m])
      )
      )
      /
      (sum(
        rate(http_request_duration_seconds_count{job="myapp"}[30m])
      )
      )
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_window: 30m
  - record: slo:sli_error:ratio_rate1h
    expr: |
      (sum(
        rate(http_request_duration_seconds_count{job="myapp", code=~"(5..|429)"}[1h])
      )
      )
      /
      (sum(
        rate(http_request_duration_seconds_count{job="myapp"}[1h])
      )
      )
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_window: 1h
  - record: slo:sli_error:ratio_rate2h
    expr: |
      (sum(
        rate(http_request_duration_seconds_count{job="myapp", code=~"(5..|429)"}[2h])
      )
      )
      /
      (sum(
        rate(http_request_duration_seconds_count{job="myapp"}[2h])
      )
      )
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_window: 2h
  - record: slo:sli_error:ratio_rate6h
    expr: |
      (sum(
        rate(http_request_duration_seconds_count{job="myapp", code=~"(5..|429)"}[6h])
      )
      )
      /
      (sum(
        rate(http_request_duration_seconds_count{job="myapp"}[6h])
      )
      )
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_window: 6h
  - record: slo:sli_error:ratio_rate1d
    expr: |
      (sum(
        rate(http_request_duration_seconds_count{job="myapp", code=~"(5..|429)"}[1d])
      )
      )
      /
      (sum(
        rate(http_request_duration_seconds_count{job="myapp"}[1d])
      )
      )
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_window: 1d
  - record: slo:sli_error:ratio_rate3d
    expr: |
      (sum(
        rate(http_request_duration_seconds_count{job="myapp", code=~"(5..|429)"}[3d])
      )
      )
      /
      (sum(
        rate(http_request_duration_seconds_count{job="myapp"}[3d])
      )
      )
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_window: 3d
  - record: slo:sli_error:ratio_rate30d
    expr: |
      sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"}[30d])
      / ignoring (sloth_window)
      count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"}[30d])
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_window: 30d
- name: sloth-slo-meta-recordings-myapp-http-availability
  rules:
  - record: slo:objective:ratio
    expr: vector(0.9998999999999999)
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
  - record: slo:error_budget:ratio
    expr: vector(1-0.9998999999999999)
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
  - record: slo:time_period:days
    expr: vector(30)
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
  - record: slo:current_burn_rate:ratio
    expr: |
      slo:sli_error:ratio_rate5m{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"}
      / on(sloth_id, sloth_slo, sloth_service) group_left
      slo:error_budget:ratio{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"}
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
  - record: slo:period_burn_rate:ratio
    expr: |
      slo:sli_error:ratio_rate30d{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"}
      / on(sloth_id, sloth_slo, sloth_service) group_left
      slo:error_budget:ratio{sloth_id="myapp-http-availability", sloth_service="myapp", sloth_slo="http-availability"}
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
  - record: slo:period_error_budget_remaining:ratio
    expr: 1 - slo:period_burn_rate:ratio{sloth_id="myapp-http-availability", sloth_service="myapp",
      sloth_slo="http-availability"}
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_service: myapp
      sloth_slo: http-availability
  - record: sloth_slo_info
    expr: vector(1)
    labels:
      cmd: examplesgen.sh
      owner: myteam
      sloth_id: myapp-http-availability
      sloth_mode: cli-gen-prom
      sloth_objective: "99.99"
      sloth_service: myapp
      sloth_slo: http-availability
      sloth_spec: prometheus/v1
      sloth_version: dev