Skip to content

feat(monitoring): define the Service SLOs in a Sloth spec #4709

Done

Description

@dan-petty

Problem or Motivation

  • No SLO, error-budget or burn-rate rule exists (grep finds 0 in k8s/monitoring).
  • The cluster has 0 PrometheusRule objects and no Prometheus operator. prometheus-server reads serverFiles from the community chart (k8s/monitoring/prometheus-values.yaml).
  • The project review, the pipeline dashboard (feat(roadmap): a dashboard and alerts for the pipeline #3655) and the SLO panels of the project design spec need one SLO source.

Proposed Solution & Architectural Design

Add k8s/monitoring/slos/*.yaml in the Sloth v0.16.0 prometheus/v1 format. Use the objectives that the owner decided on 2026-11-11, in a 28-day window (it stays inside the 30-day Prometheus retention):

SLO SLI Objective
Service round success good rounds / all rounds of devops_cli_service_jobs_total, for each row and repository 99%
Runner Job duration runner Jobs that end within 3,600 s / all runner Jobs 90%
Gateway request success gateway requests with no error / all gateway requests 99.5%
Gateway latency gateway requests that end in under 60 s / all gateway requests 95%

Measured for 7 days to 2026-11-11T14:51:23Z: devops-cli stage 58.3 successes and 98.5 errors (0.372); runner Jobs n = 94, p50 1,000.5 s, p90 2,979.2 s; gateway 38 failed of 74,151 requests, p95 35.9 s. The devops-cli stage row breaches its objective at once. That is a true signal, not a defect of the SLO.

Target Subsystem

Monitoring (k8s/monitoring/), with the pre-commit and CI checks.

Existing Tool Considered

Sloth v0.16.0 (Apache-2.0) generates the multi-window, multi-burn-rate rules from one spec, so no SLO rule is written by hand. promtool (in use in CI) checks and tests the rules. Pyrra v0.10.2 (Apache-2.0) also generates the rules, but it adds a running service and a UI that the project does not need. Cost (estimate): spec and values files plus one generation check, about 0.33-0.50 USD on the DeepSeek implement path and 1-2 days elapsed.

Acceptance Criteria

  • promtool check rules and promtool test rules pass, with one fixture for each SLO.
  • After the Argo CD sync, slo:sli_error:ratio_rate1h returns series for each SLO within 10 min.
  • The check fails when the spec changes and the file is not generated again.
  • A fixture with fewer than 20 events in the long window fires no burn alert.

Dependencies

None. The owner set the objectives on 2026-11-11.

Source: #4679

Alternatives check of 2026-11-23: in-use.
The repository already uses this tool.
Tool: slok/sloth (https://github.com/slok/sloth), Apache-2.0, last activity 2026-10-28, maintained.
Reason: Searches found Sloth v0.16.0, a maintained one-shot CLI that turns one prometheus/v1 spec into SLI recording rules and multi-window, multi-burn-rate page and ticket alerts. The issue already names it; the repository generator adds the 20-event guard and checks.

Covers:

  • One spec becomes SLI recording rules
  • Multi-window, multi-burn-rate page and ticket alerts
  • Metadata rules for error budget and objective

Lacks:

  • No minimum 20-event guard in the long window
  • No regeneration-equality check
  • No promtool fixtures or Argo CD wiring

Proposed design

Problem statement

No SLO, error-budget or burn-rate rule exists in k8s/monitoring, and the cluster runs no Prometheus operator. The project review, the pipeline dashboard (#3655) and the SLO panels of the project design spec need one SLO source. This change adds four Sloth specs in the 28-day window, generates one rule file from them, checks that the file is the output of its generator, and tests the rules with promtool. It also moves the service dashboards to the same window and moves each objective out of k8s/README.md into the spec.

Acceptance criteria

Requirement: One Sloth spec for each SLO

The change SHALL add one Sloth prometheus/v1 spec under k8s/monitoring/slos/ for each of the four SLOs.

Scenario: Four specs hold the four SLOs

  • WHEN A test reads each spec under k8s/monitoring/slos/.
  • THEN It finds four specs, each with a 28-day window and the objective of its SLO.

Requirement: Spec names a catalog service

Each SLO spec MUST name a service value that k8s/catalog.toml holds.

Scenario: An unknown service name fails the test

  • WHEN A test compares the service value of each spec with the service names of k8s/catalog.toml.
  • THEN The test passes only when each name is in the catalog.

Requirement: Runner Job caveat in the spec

The spec of the Runner Job SLO SHALL state in its description that only the runner Jobs that end count.

Scenario: The description names the Jobs that end

  • WHEN A test reads the description field of the Runner Job spec.
  • THEN The text states that a Job with no end is not in the SLI.

Requirement: Pinned Sloth binary

The change MUST pin Sloth v0.16.0 in src/devops_cli/tools_lock/tools.lock with a release URL and a sha256 for each platform.

Scenario: The lock holds the Sloth pin

  • WHEN A test reads [binary.sloth] in src/devops_cli/tools_lock/tools.lock.
  • THEN The version is 0.16.0 and every platform entry holds a URL and a sha256.

Requirement: Rules file equals a fresh generation

The check SHALL fail when k8s/monitoring/slo-rules-values.yaml differs from a fresh run of the repository generator that runs sloth generate on the specs and applies the minimum-event guard.

Scenario: A changed spec with no new generation fails

  • WHEN A test runs the generator with the pinned binary and compares its output with the committed file.
  • THEN The test passes only when the two files are equal.

Requirement: Prometheus loads the generated rules

The Prometheus release MUST load the generated rules file from its chart values.

Scenario: The file is named in rule_files and in valueFiles

  • WHEN A test reads k8s/monitoring/prometheus-values.yaml, k8s/argocd/apps/prometheus.yaml and HELM_RELEASES_BY_STACK in src/devops_cli/commands/k8s/stack_lifecycle.py.
  • THEN /etc/config/slo_rules.yml is in rule_files, and the values file is in valueFiles and in the values list of the prometheus release.

Requirement: A recording rule for each SLO

The generated file SHALL hold the slo:sli_error:ratio_rate1h recording rule of each of the four SLOs.

Scenario: Four 1-hour error-ratio rules

  • WHEN A test parses the groups of the generated file.
  • THEN Four rules named slo:sli_error:ratio_rate1h exist, one for each SLO.

Requirement: promtool checks and tests the rules

promtool check rules and promtool test rules MUST pass on the generated file, with one fixture for each SLO.

Scenario: Each SLO has a fixture

  • WHEN A test runs promtool check rules on the file and promtool test rules on the fixtures.
  • THEN Both commands exit 0 and the fixtures cover each of the four SLOs.

Requirement: No alert under 20 events

Each burn-rate alert SHALL require at least 20 events in its long window.

Scenario: A quiet row fires no page alert

  • WHEN A fixture sends fewer than 20 events in the long window of a row, with an error ratio above the page threshold.
  • THEN No page alert fires for that row.

Requirement: Ticket windows see a low-traffic row

A row with fewer than 20 runs in 1 hour MUST fire only through the 1-day and 3-day ticket windows.

Scenario: The stage row of devops-cli

  • WHEN A fixture sends at most 5 runs in 1 hour at a 7-day burn rate of 70x.
  • THEN The 1-day and 3-day ticket alerts fire and the page alert stays quiet.

Requirement: Service dashboards use 28 days

The service dashboards SHALL use slo_window_days = 28 and the 13.44x and 5.6x burn-rate lines.

Scenario: The table and the built dashboards

  • WHEN A test reads k8s/monitoring/dashboards/services.toml and the built devops-sre-service.json and devops-roadmap-service.json.
  • THEN The window is 28 days, and no SLO tile or burn-rate panel of the two dashboards holds the 14.4x or 6x line.

Requirement: README names the spec, not the objective

The four SLO rows of the section "Service levels" of k8s/README.md SHALL name the spec of each SLO and hold no objective or window.

Scenario: One place for each objective

  • WHEN A test reads the section "Service levels" of k8s/README.md.
  • THEN Each of the four rows names its spec file and holds no objective percentage or window, and the SLO 5 row keeps its objective until its own spec.

Requirement: Runbook row for each SLO alert

k8s/README.md SHALL give a runbook row for each generated SLO alert.

Scenario: Each alert has a row

  • WHEN A test reads the Alerting table of k8s/README.md.
  • THEN Each alert name of the generated file has a row.

Existing Tool Considered

Sloth v0.16.0 (Apache-2.0) is the tool: one prometheus/v1 spec becomes the SLO recording rules and the multi-window, multi-burn-rate alerts, and it runs as a one-shot CLI, so no running service or UI is added. Its repository page, fetched 2026-11-15, states that Sloth is actively maintained, shows its latest commit on 2026-10-28, and shows the tree preparing the v0.16.0 release; the alternatives check of 2026-11-14 gives the verdict in-use. Sloth lacks the minimum of 20 events in the long window, so the repository generator that wraps sloth generate adds that guard to the generated alert expressions. Sloth also gives no regeneration-equality check, no promtool fixtures, no runbook rows and no Argo CD wiring, so the repository supplies them. Pyrra v0.10.2 stays out: it adds a running service and a UI that the project does not need. Cost (estimate): the spec and values files, the generator with its guard, and the checks, about 0.33-0.50 USD on the DeepSeek implement path and 1-2 days elapsed.

Key questions

  • Which open, maintained tool generates the SLO recording rules and the burn-rate alerts?: Sloth v0.16.0 (Apache-2.0) generates the rules from one spec file. The repository page, fetched 2026-11-15, states that Sloth is actively maintained, its latest commit is 2026-10-28, and its tree prepares the v0.16.0 release; the alternatives check of 2026-11-14 gives the verdict in-use, and the item already names the tool. Pyrra adds a running service and a UI that the project does not need. (best practice) [sources: https://github.com/slok/sloth]
    • Chosen: Sloth v0.16.0. It turns one spec into the recording rules and the multi-window burn-rate alerts, and it runs as a one-shot CLI.
    • Rejected: Pyrra v0.10.2. It adds a running service and a UI that the project does not need.
    • Rejected: Hand-written rules. Each SLO would need its rules written and kept by hand, so the spec would not be the only source.
  • How does the project pin the Sloth binary?: The change adds [binary.sloth] at version 0.16.0 to src/devops_cli/tools_lock/tools.lock, with the per-platform release URL and sha256, as [binary.promtool] sits there at line 544. The CI and pre-commit check install it with uv run devops install-tools --tool sloth --only-missing, as the promtool step of ci.yml does, so the check runs the same pinned binary everywhere. tools.lock is present at this commit and its header says it holds every tool that devops install-tools installs; the body's premise that refactor(security): tools are found on PATH and not in tools.lock #4362 and chore(tools): remove devops install-tools and tools.lock #4363 remove it has no copy in the tree. (best practice) [sources: src/devops_cli/tools_lock/tools.lock:1, src/devops_cli/tools_lock/tools.lock:544, .github/workflows/ci.yml:180, docs/CLUSTER.md:62]
    • Chosen: Add [binary.sloth] to src/devops_cli/tools_lock/tools.lock. The lock is the pin that devops install-tools reads, it already holds promtool at line 544, and the devcontainer and CI both install its tools.
    • Rejected: Pin only in .devcontainer/Dockerfile by URL and sha256. It gives CI and the pre-commit hook no installer entry, so the check cannot fetch the pinned binary.
    • Rejected: Pin a container image by digest. It adds an image pull to each check, and no other CLI tool of the repository runs that way.
  • Which window and which objectives do the four SLOs use?: Each SLO uses the 28-day window and the objective of the SLO table of k8s/README.md: 99% for the Service round success, 90% for the Runner Job duration, 99.5% for the gateway request success and 95% for the gateway latency. The window stays inside the 30-day Prometheus retention. [sources: k8s/README.md:546, k8s/README.md:548-554, docs/guidelines/sre.md:52, k8s/monitoring/prometheus-values.yaml:11]
  • Where does the generated rule file live, and how does Prometheus load it?: The generated file is k8s/monitoring/slo-rules-values.yaml, a Helm values file with the groups under serverFiles.slo_rules.yml. The rule_files list of k8s/monitoring/prometheus-values.yaml adds /etc/config/slo_rules.yml. The Application prometheus lists the values file in valueFiles, and the prometheus entry of HELM_RELEASES_BY_STACK names it in its values list. (best practice) [sources: k8s/monitoring/prometheus-values.yaml:193-202, k8s/argocd/apps/prometheus.yaml:15-17, src/devops_cli/commands/k8s/stack_lifecycle.py:187-195]
    • Chosen: A serverFiles key in a third values file. The chart writes each serverFiles key to the ConfigMap that the server mounts, and the file stays the output of one generator.
    • Rejected: PrometheusRule objects. No Prometheus operator reconciles them, and the server reads serverFiles from the community chart.
    • Rejected: Hand-copied rule groups. The spec would not be the only source, and the generation check would have nothing to compare.
  • Does the generated values file set serverFiles.prometheus.yml.rule_files itself?: No. The list stays in k8s/monitoring/prometheus-values.yaml, which adds /etc/config/slo_rules.yml. A values file that sets the list replaces it, and the 4 chart defaults and the product rule file would leave the server. (best practice) [sources: k8s/monitoring/prometheus-values.yaml:196-202, k8s/devops/monitoring/prometheus-rules-values.yaml:6]
    • Chosen: Add the file name to rule_files in the environment values. One list keeps the chart defaults, the product rules and the SLO rules.
    • Rejected: Set rule_files in the generated values file. Helm replaces a list, so the 4 chart defaults and the product rule file would drop.
  • How does the low-sample rule enter the generated alerts?: Sloth generates no minimum-event condition. The repository generator that runs sloth generate appends one condition on the SLO's event count over the alert's long window (>= 20) to each burn-rate alert expression, and the equality check compares the committed file with that generator's output, not with bare sloth generate. A fixture proves it for a quiet row and for the stage row of devops-cli. (best practice) [sources: docs/guidelines/sre.md:54, docs/guidelines/sre.md:71, k8s/README.md:560]
    • Chosen: Add a condition on the event count of the long window in the repository generator. It keeps the owner rule of 20 events and the burn-rate lines of the SLO, and the generated file stays reproducible.
    • Rejected: Lower the burn-rate threshold. It changes the page line, and the owner set the line and the 20 events apart.
    • Rejected: Add no guard. A quiet row would page on one error, against the owner rule.
  • Which window and which burn-rate lines do the service dashboards use?: The service dashboards use slo_window_days = 28, with the 13.44x page line and the 5.6x ticket line that docs/DESIGN.md C12(c) gives for 28 days. The line is computed from the window (share * window hours / hours), so the 30-day values 14.4x and 6x go with the window change. (best practice) [sources: k8s/monitoring/dashboards/services.toml:20, k8s/monitoring/dashboards/services.toml:31, docs/DESIGN.md:230, src/devops_cli/grafana/service_dashboard.py:465]
    • Chosen: 28 days with 13.44x and 5.6x. The dashboards then show the window and the lines of the Sloth specs.
    • Rejected: Keep 30 days with 14.4x and 6x. The dashboards would not match the SLO window, and the lines are the 30-day values.
  • Does the SLO table of k8s/README.md keep the objectives after this change?: No for the four SLOs of this change: their rows name the spec of each SLO and hold no objective or window, so the spec is the only place of each. The SLO 5 row (ingress) keeps its objective, because it is not one of the four SLOs of this item and no spec holds it yet. The runbook rows of the alerts stay in k8s/README.md. (best practice) [sources: k8s/README.md:546, k8s/README.md:548-556, openspec/changes/archive/2026-11-13-5538-split-the-sre-spec/tasks.md:36]
    • Chosen: Move the four objectives to the specs and name the spec from each row. One copy of each objective and window, and the table points to it.
    • Rejected: Keep the objectives in both places. Two copies drift, and no check compares them.
    • Rejected: Move the SLO 5 objective too. This item adds no ingress spec, so SLO 5 would lose its only target.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/monitoring
    status/new
    value/high
    effort/medium
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/monitoring. The (monitoring) scope of the title gives the scope.
    • Priority: P2-Medium. The project has zero SLOs and multiple items reference needing one, but no outage or regression blocks this work.
    • Value: High. It gives the project its first SLO source, which the review, dashboard, and design spec all depend on.
    • Effort: Medium. The body estimates 1-2 days for spec files, generation checks, and runbook rows.
    • Related: feat(monitoring): the roadmap Service's identity refusals, failing and stalled jobs, restarts, and GitHub and model request volume raise alerts #2472, which asks for a different change. Both add Prometheus rules for the roadmap Service in k8s/monitoring, but #2472 delivers specific condition alerts while this candidate delivers SLO objectives with multi-window burn-rate rules.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    The SRE service spec (#5445, docs/SRE.md) uses the 28-day window of this Sloth spec for each SLO.

    • The service dashboards of k8s/monitoring/dashboards/services.toml still use slo_window_days = 30 and the 30-day page lines 14.4x and 6x. docs/DESIGN.md C12 (c) now gives the page lines of both windows: 13.44x and 5.6x for 28 days. Please set the window of the service dashboards to 28 days in this change.
    • Under the low-sample rule, a row with fewer than 20 runs in 1 hour gets no page alert. For example, the row stage of devops-cli had at most 5 runs in an hour in 7 days, at a 7-day burn rate of 70x. Only the 1 d and 3 d ticket windows can see such a row. Please keep a test for this case.
  6. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    Scope from the spec split (2026-11-13)

    The split of the SRE spec (#5538) adds k8s/catalog.toml and a catalog generator (#5535). For the Sloth specs of this item:

    • Give each spec the service name of its k8s/catalog.toml entry. The catalog generator joins the SLI, the objective and the window by this name, and fails on a name that the catalog does not hold.
    • Put the SLO 2 caveat in the description of its spec: only the runner Jobs that end count, so a Job that runs with no end is not in the SLI.
    • Move the objectives out of the SLO rows of the section "Service levels" of k8s/README.md. docs(monitoring): split the SRE spec into a guideline and decisions #5538 adds these rows until this item merges. After the merge, the spec is the only place of each objective and window.
  7. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches found Sloth, the Apache-2.0 SLO generator that the issue itself already names: it turns one SLO spec into Prometheus recording rules and multi-window, multi-burn-rate alerts, with no extra running service (Pyrra, the alternative the issue rejects, adds a service and UI). No ADR in force rejects it, and its generated rule groups are what the issue's promtool checks and generation-equality check would validate.

    The repository already uses this tool.

    Tool: slok/sloth (https://github.com/slok/sloth)

    • License: Apache-2.0
    • Last activity: 2026-10-28
    • Maintained: yes

    Covers:

    • Generates uniform Prometheus SLO recording rules and multi-window, multi-burn-rate alert rules from one declarative spec file
    • Provides the SLO, objective and window fields the issue needs, so no SLO rule is written by hand
    • Runs as a one-shot CLI generator, so no long-running SLO service or UI is added to the cluster
    • Generated rules can be checked and tested with promtool before they are loaded

    Lacks:

    • The minimum of 20 events in the long window is not part of Sloth's default generated alert expressions; the guard has to be added to the expressions
    • The regeneration-equality check, the promtool fixtures, the runbook rows and the Argo CD valueFiles wiring are repository work, not provided by Sloth

    Tools considered:

    Searches run:

    • Sloth generate plain Prometheus rule groups without PrometheusRule CRD, results: 5
    • Sloth SLO generator multi-window multi-burn-rate Prometheus rules, results: 5
    • Pyrra vs Sloth SLO Prometheus rules generator, results: 5
    • slok/sloth GitHub SLO generator, results: 5
    • sloth.dev SLO generator documentation generate, results: 5
    • "sloth generate" prometheus rules yaml example SLO spec, results: 5
    • Sloth SLO generator alerting burn rate windows minimum events, results: 5
    • sloth.dev, results: 5
    • Sloth Prometheus SLO generator github readme, results: 5
    • "sloth" SLO generator kubernetes PrometheusRule output raw rules, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    status/ready
    and removed
    status/new
    on Nov 15, 2026
  9. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at cd3e0f9 (see proposed design in issue body).

  10. 85 remaining items

  11. added
    status/in-review
    and removed
    status/in-progress
    on Nov 25, 2026
  12. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    The runner Job devops-cli-implement-devops-cli-4709-2e82af ended: succeeded.
    Image digest: sha256:50fb50c12971cbc9c7be8061af3dfefbac50c35e1262851e33ab0623a9cf84d8

    The last lines of its log:

    (no log: the Job has no pod)

    Failure class: ci_infra.
    Action taken: none.
    Action left: retry: run the item again.

    The Job left this item without a result. The item is Blocked. When a retry can fix the class of the stop, the Service starts a new Job in the next round. The limit is roadmap.implement.continuations_per_item, and the comment of that round says so. If no continuation is left, fix the cause. Then comment implement: retry. A new runner image also clears the stop. This holds only if a retry can fix the class of the stop. The limits of roadmap.implement.digest_clears_per_class and roadmap.implement.digest_clears_per_item must also allow it.

  13. added
    status/blocked
    and removed
    owner/service
    status/in-review
    on Nov 25, 2026
  14. added
    status/in-review
    and removed
    status/blocked
    on Nov 25, 2026
  15. removed
    status/in-review
    on Nov 25, 2026
  16. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor
  17. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 03:35 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/monitoringsource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions