sloth

slokApache-2.0活跃维护

从 SLO 定义自动生成 Prometheus 告警规则和记录规则,省去手写 PromQL 的麻烦,适合在 Kubernetes 上做服务等级目标监控。

🦥 Easy and simple Prometheus SLO (service level objectives) generator

v0.16.0发布于 2026-04-04 08:10 UTC2,569star232fork同步于 2026-11-10 11:43 UTC

怎么上手

由 README 提炼,执行前请确认
sloth generate -i ./examples/getting-started.yml
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用一份简单 SLO 规格自动生成 Prometheus SLO 指标与多窗口多燃烧率告警

从 SLO 定义自动生成 Prometheus 告警规则和记录规则,省去手写 PromQL 的麻烦,适合在 Kubernetes 上做服务等级目标监控。

核心能力

  • 基于 Google SLO 与多窗口多燃烧率告警框架生成规则
  • 自动生成不同时间窗口的 Prometheus SLI recording rules
  • 自动生成 SLO 元数据规则与 page、warning 告警规则
  • 提供 validate 命令校验 SLO 规格,适配 GitOps 与 CI
  • 支持 Kubernetes Prometheus-operator、CRD 控制器与 OpenSLO

容易踩的坑

需自行准备符合规范的 SLO 规格 YAML 文件作为输入;SLI 插件需参考独立仓库 slok/sloth-common-sli-plugins;Kubernetes 控制器模式需额外部署 CRD 与 operator

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.16.0
  1. sloth-helm-chart-0.16.0pre-release2026-04-04 · 2026-04-04 08:53 UTC
    查看更新说明

    Base chart for Sloth.

  2. v0.16.0最新正式版2026-04-04 · 2026-04-04 08:10 UTC

    v0.16.0 - 2026-04-04

    Check the release notes in discussions.

    Added

    • K8s transformer plugins to be able to customize the k8s resulting objects without depending on current Prometheys operator Rule CR.
    • sloth.dev/k8stransform/prom-operator-prometheus-rule/v1 K8s transformer plugin.
    • Users can now create multiple K8s objects as the output of the SLO generated rules.
    • Sloth lib support for K8s transformer plugins using WriteResultAsK8sObjects.
    • New server command that serves the new UI.
    • UI: Service listing and searching.
    • UI: SLO listing, searching and filtered by service.
    • UI: SLO details with stats, alerts state, SLI chart and budged burn in period chart.
    • UI: Support SLO grouped by labels.
    • UI: Redirect unmarshaled ID of grouped SLO labels to proper SLO ID.
    • UI: Support service list sort by name and alert status.
    • UI: Support alert firing, burning over budget and budget consumed in period SLO filtering on SLO listing.
    • Update to Kubernetes v1.35.
    • validate command will check for SLO duplicates (disable with --ignore-slo-duplicates).

    Changed

    • Sloth now uses a dynamic unstructured plugin (sloth.dev/k8stransform/prom-operator-prometheus-rule/v1) to create and manage the prometheus operator Rule K8s CRs.
    • BREAKING: Plugin loader will ignore directories starting with ...
  3. sloth-helm-chart-0.15.0pre-release2025-10-31 · 2025-10-31 16:28 UTC
    查看更新说明

    Base chart for Sloth.

  4. v0.15.02025-10-31 · 2025-10-31 08:14 UTC
    查看更新说明

    Check out the announcement

    v0.15.0 - 2025-10-31

    Added

    • Sloth SLO generation can be used as a Go library in github.com/slok/sloth/pkg/lib.
    • Sloth lib PrometheusSLOGenerator with GenerateFromSlothV1 to generate SLOs based on Sloth v1 spec.
    • Sloth lib PrometheusSLOGenerator with GenerateFromK8sV1 to generate SLOs based on Kubernetes Sloth v1 spec.
    • Sloth lib PrometheusSLOGenerator with GenerateFromOpenSLOV1Alpha to generate SLOs based on OpenSLO v1Alpha spec.
    • Sloth lib PrometheusSLOGenerator with GenerateFromRaw to generate SLOs based on any raw string spec.
    • Sloth lib WriteResultAsPrometheusStd helper method to write generated SLO results into standard Prometheus rules YAML.
    • Sloth lib WriteResultAsK8sPrometheusOperator helper method to write generated SLO results into Prometheus operator rules YAML.
    • The resulting SLO Prometheus rule group name can be customized by SLO plugins.
    • SLO plugins have the ability to add extra Prometheus Rule groups.

    Changed

    • The CLI commands generate and validate use the public Sloth Go library.
  5. v0.14.02025-10-14 · 2025-10-14 18:26 UTC
    查看更新说明

    Check the announcement here

    v0.14.0

    Highlights

    Added

    • Add contrib plugin directory and CODEOWNERS policies.
    • Contrib plugin: /internal/plugin/slo/contrib/info_labels_v1/.
    • Allow github.com/VictoriaMetrics/metricsql module in SLO plugins.
    • Contrib plugin: sloth.dev/contrib/validate_victoria_metrics/v1.
    • Contrib plugin: sloth.dev/contrib/rule_intervals/v1.
    • Contrib plugin: sloth.dev/contrib/error_budget_exhausted_alert/v1.
    • Contrib plugin: sloth.dev/contrib/denominator_corrected_rules/v1.
    • Add --slo-plugins and -s flag (validate) to be able to declare SLO plugins at cmd level, these plugins will be applied to all SLOs.
    • Add --disable-default-slo-plugins flag (validate) to be able to disable default Sloth SLO plugins.

    Changed

    • Update chat git sync to v4.5.0

    Detailed and Autogenerated

    What's Changed

    Full Changelog: https://github.com/slok/sloth/compare/v0.13.0...v0.14.0

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Sloth

    CI Go Report Card Apache 2 licensed GitHub release (latest SemVer) Kubernetes release OpenSLO

    Project status

    Sloth is actively maintained and in continuous development.

    We’re currently working on internal improvements to make Sloth even more extensible and adaptable to real-world use cases. While Sloth already supports custom SLI plugins, upcoming changes will bring more flexibility to how SLOs are generated, making it easier to adapt Sloth to your custom needs. Stay tuned for updates!

    Introduction

    Meet the easiest way to generate SLOs for Prometheus.

    Sloth generates understandable, uniform and reliable Prometheus SLOs for any kind of service. Using a simple SLO spec that results in multiple metrics and multi window multi burn alerts.

    https://sloth.dev

    Features

    • Simple, maintainable and understandable SLO spec.
    • Reliable SLO metrics and alerts.
    • Based on Google SLO implementation and multi window multi burn alerts framework.
    • Autogenerates Prometheus SLI recording rules in different time windows.
    • Autogenerates Prometheus SLO metadata rules.
    • Autogenerates Prometheus SLO multi window multi burn alert rules (Page and warning).
    • SLO spec validation (including validate command for Gitops and CI).
    • Customization of labels, disabling different type of alerts...
    • A single way (uniform) of creating SLOs across all different services and teams.
    • Automatic Grafana dashboard to see all your SLOs state.
    • Single binary and easy to use CLI.
    • Kubernetes (Prometheus-operator) support.
    • Kubernetes Controller/operator mode with CRDs.
    • Support different SLI types.
    • Support for SLI plugins
    • A library with common SLI plugins.
    • OpenSLO support.
    • Safe SLO period windows for 30 and 28 days by default.
    • Customizable SLO period windows for advanced use cases.

    Small Sloth SLO dashboard

    Getting started

    Release the Sloth!

    sloth generate -i ./examples/getting-started.yml
    
    version: "prometheus/v1"
    service: "myservice"
    labels:
      owner: "myteam"
      repo: "myorg/myservice"
      tier: "2"
    slos:
      # We allow failing (5xx and 429) 1 request every 1000 requests (99.9%).
      - name: "requests-availability"
        objective: 99.9
        description: "Common SLO based on availability for HTTP request responses."
        labels:
          category: availability
        sli:
          events:
            error_query: sum(rate(http_request_duration_seconds_count{job="myservice",code=~"(5..|429)"}[{{.window}}]))
            total_query: sum(rate(http_request_duration_seconds_count{job="myservice"}[{{.window}}]))
        alerting:
          name: "MyServiceHighErrorRate"
          labels:
            category: "availability"
          annotations:
            # Overwrite default Sloth SLO alert summmary on ticket and page alerts.
            summary: "High error rate on 'myservice' requests responses"
          page_alert:
            labels:
              severity: "pageteam"
              routing_key: "myteam"
          ticket_alert:
            labels:
              severity: "slack"
              slack_channel: "#alerts-myteam"
    

    This would be the result you would obtain from the above spec example.

    Documentation

    Check the docs to know more about the usage, examples, and other handy features!

    SLI plugins

    Looking for common SLI plugins? Check this repository, if you are looking for the sli plugins docs, check this instead.

    Development and Contributing

    Check CONTRIBUTING.md.