MCPcopy
hub / github.com/slok/sloth

github.com/slok/sloth @sloth-helm-chart-0.16.0 sqlite

repository ↗ · DeepWiki ↗ · release sloth-helm-chart-0.16.0 ↗
1,417 symbols 3,954 edges 230 files 511 documented · 36%
README
<img src="https://github.com/slok/sloth/raw/sloth-helm-chart-0.16.0/docs/img/logo.png" width="15%" align="center" alt="sloth">

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.

Extension points exported contracts — how you extend this code

SLOProcessor (Interface)
SLOProcessor is the interface that will be used to process SLO and generate rules. This is an abstraction to be able to [17 …
internal/app/generate/process.go
Command (Interface)
Command represents an application command, all commands that want to be executed should implement and setup on main. [5 …
cmd/sloth/commands/commands.go
PrometheusServiceLevelsGetter (Interface)
PrometheusServiceLevelsGetter has a method to return a PrometheusServiceLevelInterface. A group's client should implemen [4 …
pkg/kubernetes/gen/clientset/versioned/typed/sloth/v1/prometheusservicelevel.go
ServiceGetter (Interface)
(no doc) [6 implementers]
internal/http/backend/storage/storage.go
SLODialectValidator (Interface)
SLODialectValidator is the interface that all SLO dialects must implement to validate SLOs. A dialect can me Prometheus [3 …
pkg/common/validation/slo.go
SLOPluginLoader (Interface)
(no doc) [4 implementers]
internal/storage/fs/plugin.go
WindowsRepo (Interface)
WindowsRepo knows how to retrieve windows based on the period of time. [1 implementers]
internal/alert/alert.go
Plugin (Interface)
Plugin knows how to process SLOs in a chain of plugins. * The plugin processor can change the result argument of the SLO
pkg/prometheus/plugin/slo/v1/v1.go

Core symbols most depended-on inside this repo

Errorf
called by 456
internal/log/log.go
Get
called by 224
pkg/kubernetes/gen/listers/sloth/v1/prometheusservicelevel.go
Run
called by 121
cmd/sloth/commands/commands.go
Return
called by 111
internal/http/backend/storage/prometheus/prometheusmock/mocks.go
Return
called by 53
internal/storage/fs/fsmock/mocks.go
Return
called by 50
internal/http/backend/storage/storagemock/mocks.go
WithValues
called by 47
internal/log/log.go
Return
called by 34
internal/http/ui/uimock/mocks.go

Shape

Method 698
Function 376
Struct 277
Interface 43
TypeAlias 16
FuncType 7

Languages

Go99%
TypeScript1%

Modules by API surface

internal/http/backend/storage/prometheus/prometheusmock/mocks.go130 symbols
internal/http/backend/storage/storagemock/mocks.go62 symbols
internal/http/ui/uimock/mocks.go34 symbols
internal/storage/fs/fsmock/mocks.go30 symbols
pkg/kubernetes/api/sloth/v1/zz_generated.deepcopy.go28 symbols
internal/http/ui/htmx/htmx.go26 symbols
pkg/kubernetes/gen/applyconfiguration/sloth/v1/prometheusservicelevel.go25 symbols
internal/pluginengine/slo/custom/github_com-prometheus-prometheus-promql-parser.go24 symbols
pkg/kubernetes/gen/informers/externalversions/factory.go21 symbols
internal/log/log.go19 symbols
internal/http/backend/app/slo.go19 symbols
cmd/sloth/commands/k8scontroller.go18 symbols

Dependencies from manifests, versioned

dario.cat/mergov1.0.2 · 1×
github.com/Azure/go-ansitermv0.0.0-2025010203350 · 1×
github.com/MakeNowJust/heredocv1.0.0 · 1×
github.com/Masterminds/goutilsv1.1.1 · 1×
github.com/Masterminds/semver/v3v3.4.0 · 1×
github.com/OpenSLO/oslov0.12.0 · 1×
github.com/ProtonMail/go-cryptov1.3.0 · 1×
github.com/VictoriaMetrics/metricsv1.42.0 · 1×
github.com/VictoriaMetrics/metricsqlv0.86.0 · 1×

For agents

$ claude mcp add sloth \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact