https://github.com/pyrra-dev/pyrra

Making SLOs with Prometheus manageable, accessible, and easy to use for everyone!

https://github.com/pyrra-dev/pyrra

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 52 committers (1.9%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

docker golang kubernetes metrics monitoring prometheus slo thanos time-series

Keywords from Contributors

action interactive projection excel charts sequences arrow observability autograding hacking
Last synced: 6 months ago · JSON representation

Repository

Making SLOs with Prometheus manageable, accessible, and easy to use for everyone!

Basic Info
  • Host: GitHub
  • Owner: pyrra-dev
  • License: apache-2.0
  • Language: Go
  • Default Branch: main
  • Homepage: https://demo.pyrra.dev
  • Size: 22.4 MB
Statistics
  • Stars: 1,404
  • Watchers: 8
  • Forks: 130
  • Open Issues: 118
  • Releases: 42
Topics
docker golang kubernetes metrics monitoring prometheus slo thanos time-series
Created almost 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License

README.md

Pyrra: SLOs with Prometheus

Making SLOs with Prometheus manageable, accessible, and easy to use for everyone!

Screenshot of Pyrra

Dashboards to visualize SLOs in Grafana:

Pyrra Grafana dashboard

Watch the 5min lightning talk at Prometheus Day 2022:

PrometheusDay 2022: Lightning Talk Pyrra

Features

  • Support for Kubernetes, Docker, and reading from the filesystem
  • Alerting: Generates 4 Multi Burn Rate Alerts with different severity
  • Page listing all Service Level Objectives
    • Search through names and labels
    • Sorted by remaining error budget to see the worst ones quickly
    • All columns sortable
    • View and hide individual columns
    • Clicking on labels to filter SLOs that contain the label
    • Tool-tips when hovering for extra context
  • Page with details for a Service Level Objective
    • Objective, Availability, Error Budget highlighted as 3 most important numbers
    • Graph to see how the error budget develops over time
    • Time range picker to change graphs
    • Switch between absolute and relative chart scales
    • Request, Errors, Duration (RED) graphs for the underlying service
    • Multi Burn Rate Alerts overview table
  • Caching of Prometheus query results
  • Thanos: Disabling of partial responses and downsampling to 5m and 1h
  • connect-go and connect-web generate protobuf APIs
  • Grafana dashboard via --generic-rules generation

Feedback & Support

If you have any feedback, please open a discussion in the GitHub Discussions of this project.
We would love to learn what you think!

Demo

Check out our live demo on demo.pyrra.dev!
Grafana dashboards are available as demo on demo.pyrra.dev/grafana!

Feel free to give it a try there!

How It Works

There are three components of Pyrra, all of which work through a single binary:

  • The UI displays SLOs, error budgets, burn rates, etc.
  • The API delivers information about SLOs from a backend (like Kubernetes) to the UI.
  • A backend watches for new SLO objects and then creates Prometheus recording rules for each.
    • For Kubernetes, there is a Kubernetes Operator available
    • For everything else, there is a filesystem-based Operator available

For the backend/operator to do its work, an SLO object has to be provided in YAML-format:

yaml apiVersion: pyrra.dev/v1alpha1 kind: ServiceLevelObjective metadata: name: pyrra-api-errors namespace: monitoring labels: prometheus: k8s role: alert-rules pyrra.dev/team: operations # Any labels prefixed with 'pyrra.dev/' will be propagated as Prometheus labels, while stripping the prefix. spec: target: "99" window: 2w description: Pyrra's API requests and response errors over time grouped by route. indicator: ratio: errors: metric: http_requests_total{job="pyrra",code=~"5.."} total: metric: http_requests_total{job="pyrra"} grouping: - route

Depending on your mode of operation, this information is provided through an object in Kubernetes, or read from a static file.

In order to calculate error budget burn rates, Pyrra will then proceed to create Prometheus recording rules for each SLO.

The following rules would be created for the above example:

``` http_requests:increase2w

httprequests:burnrate3m httprequests:burnrate15m httprequests:burnrate30m httprequests:burnrate1h httprequests:burnrate3h httprequests:burnrate12h http_requests:burnrate2d ```

The recording rules names are based on the originally provided metric. The recording rules contain the necessary labels to uniquely identify the recording rules in case there are multiple ones available.

Running inside a Kubernetes cluster

An example for this mode of operation can be found in examples/kubernetes.

Kubernetes Architecture

Here two deployments are needed: one for the API / UI and one for the operator. For the first deployment, start the binary with the api argument.

When starting the binary with the kubernetes argument, the service will watch the apiserver for ServiceLevelObjectives. Once a new SLO is picked up, Pyrra will create PrometheusRule objects that are automatically picked up by the Prometheus Operator.

If you're unable to run the Prometheus Operator inside your cluster, you can add the --config-map-mode=true flag after the kubernetes argument. This will save each recording rule in a separate ConfigMap.

Applying YAML

This repository contains generated YAML files in the examples/kubernetes/manifests folder. You can use the following commands to deploy them to a cluster right away.

bash kubectl apply --server-side -f ./example/kubernetes/manifests/setup kubectl apply --server-side -f ./example/kubernetes/manifests kubectl apply --server-side -f ./example/kubernetes/manifests/slos

Applying YAML and validating webhooks via cert-manager

This repository contains more generated YAML files in the examples/kubernetes/manifests-webhook folder.

This example deployment additionally applies and self-sign Issuer and requests a certificate via cert-manager, so that the Kubernetes APIServer can connect to Pyrra to validate any configuration object before applying it to the cluster.

bash kubectl apply --server-side -f ./example/kubernetes/manifests-webhook/setup kubectl apply --server-side -f ./example/kubernetes/manifests-webhook kubectl apply --server-side -f ./example/kubernetes/manifests-webhook/slos

kube-prometheus

The underlying jsonnet code is imported by the kube-prometheus project. If you want to install an entire monitoring stack including Pyrra we highly recommend using kube-prometheus.

Install with Helm

Thanks to @rlex there is a Helm chart for deploying Pyrra too.

Running inside Docker / Filesystem

An example for this mode of operation can be found in examples/docker-compose.

Filesystem Architecture

You can easily start Pyrra on its own via the provided Docker image:

bash docker pull ghcr.io/pyrra-dev/pyrra:v0.7.0

When running Pyrra outside of Kubernetes, the SLO object can be provided through a YAML file read from the file system. For this, one container or binary needs to be started with the api argument and the reconciler with the filesystem argument.

Here, Pyrra will save the generated recording rules to disk where they can be picked up by a Prometheus instance. While running Pyrra on its own works, there won't be any SLO configured, nor will there be any data from a Prometheus to work with. It's designed to work alongside a Prometheus.

Configuration Options

API Command Flags

When running pyrra api, you can configure various options:

Prometheus Configuration

  • --prometheus-url - The URL to the Prometheus to query (default: http://localhost:9090)
  • --prometheus-external-url - The URL for the UI to redirect users to when opening Prometheus

Grafana Integration

As an alternative to redirecting to Prometheus, Pyrra can redirect to Grafana Explore for a richer query experience:

  • --grafana-external-url - The URL for the UI to redirect users to Grafana Explore page
  • --grafana-external-org-id - The Grafana Explore organization id (default: 1)
  • --grafana-external-datasource-id - The Grafana Explore prometheus datasource id (required when using --grafana-external-url)

Note: You cannot use both --prometheus-external-url and --grafana-external-url at the same time. Choose one based on your preference.

Example Usage

Using Prometheus external URL: bash pyrra api \ --prometheus-url=http://prometheus:9090 \ --prometheus-external-url=http://prometheus.example.com \ --api-url=http://pyrra-filesystem:9444

Using Grafana external URL: bash pyrra api \ --grafana-external-url=http://grafana:3000 \ --grafana-external-datasource-id=cemv8t0tc1hq8b \ --api-url=http://pyrra-filesystem:9444

Tech Stack

Client: TypeScript with React, Bootstrap, and uPlot.

Server: Go with libraries such as: chi, ristretto, xxhash, client-go.

Generated protobuf APIs with connect-go for Go and connect-web for TypeScript.

Roadmap

Best to check the Projects board and if you cannot find what you're looking for feel free to open an issue!

Contributing

Contributions are always welcome!

See CONTRIBUTING.md for ways to get started.

Please adhere to this project's code of conduct.

Maintainers

| Name | Area | GitHub | Twitter | Company | | :------------- | :---------- | :------------------------------------------------- | :-------------------------------------------------- | :------------ | | Nadine Vehling | UX/UI | @nadinevehling | @nadinevehling | Grafana Labs | | Matthias Loibl | Engineering | @metalmatze | @metalmatze | Polar Signals |

We are mostly maintaining Pyrra in our free time.

Acknowledgements

@aditya-konarde, @brancz, @cbrgm, @codesome, @ekeih, @guusvw, @jzelinskie, @kakkoyun, @lilic, @markusressel, @morremeyer, @mxinden, @numbleroot, @paulfantom, @RiRa12621, @tboerger, and Maria Franke.

While we were working on Pyrra in private these amazing people helped us with a look of feedback and some even took an extra hour for a in-depth testing! Thank you all so much!

Additionally, @metalmatze would like to thank Polar Signals for allowing us to work on this project in his 20% time.

FAQ

Why not use Grafana in this particular use case?

Right now we could have used Grafana indeed. In upcoming releases, we plan to add more interactive features to give you better context when coming up with new SLOs. This is something we couldn't do with Grafana.

Do I still need Grafana?

Yes, Grafana is an amazing data visualization tool for Prometheus metrics. You can create your own custom dashboards and dive a lot deeper into each component while debugging.

Does it work with Thanos too?

Yes, in fact I've been developing this against my little Thanos cluster most of the time.
The queries even dynamically add headers for downsampling and disable partial responses.

How many instances should I deploy?

It depends on the topology of your infrastructure, however, we think that alerting should still happen within each individual Prometheus and therefore running one instance with one Prometheus (pair) makes the most sense. Pyrra itself only needs one instance per Prometheus (pair).

Why don't you support more complex SLOs?

For now, we try to accomplish an easy-to-setup workflow for the most common SLOs. It is still possible to write these more complex SLOs manually and deploy them to Prometheus along those generated. You can base more complex SLOs on the output of one SLO from this tool.

Why is the objective target a string not a float?

Kubebuilder doesn't support floats in CRDs...
Therefore, we need to pass it as string and internally convert it from string to float64.

Related

Here are some related projects:

Owner

  • Name: pyrra-dev
  • Login: pyrra-dev
  • Kind: organization

GitHub Events

Total
  • Create event: 189
  • Release event: 6
  • Issues event: 31
  • Watch event: 162
  • Delete event: 182
  • Issue comment event: 175
  • Push event: 207
  • Pull request review comment event: 8
  • Pull request review event: 11
  • Pull request event: 399
  • Fork event: 18
Last Year
  • Create event: 189
  • Release event: 6
  • Issues event: 31
  • Watch event: 162
  • Delete event: 182
  • Issue comment event: 175
  • Push event: 207
  • Pull request review comment event: 8
  • Pull request review event: 11
  • Pull request event: 399
  • Fork event: 18

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 1,201
  • Total Committers: 52
  • Avg Commits per committer: 23.096
  • Development Distribution Score (DDS): 0.515
Past Year
  • Commits: 143
  • Committers: 16
  • Avg Commits per committer: 8.938
  • Development Distribution Score (DDS): 0.294
Top Committers
Name Email Commits
dependabot[bot] 4****] 583
Matthias Loibl m****l@m****m 484
Alexander Knipping a****g@e****e 19
Marius Svechla m****a@g****m 12
Julien Pivotto r****e@o****u 8
Bradley b****t@g****m 6
Arthur Silva Sens a****5@g****m 6
Nadine Vehling 7****g 4
Alfonso Subiotto Marques a****o@p****m 4
Manoj Vivek p****k@g****m 4
yeya24 y****7@g****m 3
paulfantom p****l@k****l 3
Zane Williamson z****w@h****m 3
Sebastian Diez s****z@b****e 3
Alby Hernández d****o@g****m 3
Adrien Bestel a****l@d****m 3
Adrien Bestel a****l@d****m 3
Luke Atkinson l****n@p****m 3
Brad Ison b****n@x****o 2
Carl Henrik Lunde c****e@i****o 2
David Calvert d****d@0****e 2
Mariusz Mazur m****r@r****m 2
Maxim Muzafarov m****v@g****m 2
Reto Kupferschmid k****d@p****h 2
Saswata Mukherjee s****a@y****m 2
Sebastian Gaiser s****r 2
Zach Robinson z****v@g****m 2
Ziqi Zhao z****6@g****m 2
adinhodovic h****n@g****m 2
samuel.wright s****t@k****m 2
and 22 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 107
  • Total pull requests: 872
  • Average time to close issues: 3 months
  • Average time to close pull requests: 18 days
  • Total issue authors: 75
  • Total pull request authors: 44
  • Average comments per issue: 1.76
  • Average comments per pull request: 0.57
  • Merged pull requests: 441
  • Bot issues: 2
  • Bot pull requests: 746
Past Year
  • Issues: 23
  • Pull requests: 394
  • Average time to close issues: 17 days
  • Average time to close pull requests: 9 days
  • Issue authors: 19
  • Pull request authors: 17
  • Average comments per issue: 0.35
  • Average comments per pull request: 0.38
  • Merged pull requests: 198
  • Bot issues: 0
  • Bot pull requests: 355
Top Authors
Issue Authors
  • metalmatze (9)
  • ArthurSens (4)
  • svenmueller (4)
  • hsolberg (3)
  • PabloPie (3)
  • dotdc (2)
  • LukeDAtkinson (2)
  • imperatives (2)
  • giz33 (2)
  • mtthwcmpbll (2)
  • dependabot[bot] (2)
  • teyyubismayil (2)
  • fstr (2)
  • prein (2)
  • verejoel (2)
Pull Request Authors
  • dependabot[bot] (746)
  • metalmatze (45)
  • abestel (5)
  • sebastiangaiser (5)
  • adinhodovic (4)
  • ArthurSens (3)
  • bbrandt (3)
  • jmleddy (3)
  • fstr (2)
  • achetronic (2)
  • bison (2)
  • dotdc (2)
  • jrRibeiro (2)
  • alexberry (2)
  • saswatamcode (2)
Top Labels
Issue Labels
bug (4) go (3) enhancement (2) component/filesystem (2) dependencies (2) component/api (1) good first issue (1) javascript (1) component/kubernetes (1) area/design (1)
Pull Request Labels
dependencies (746) go (323) javascript (194) github_actions (175) docker (54) bug (1) enhancement (1) area/design (1)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 42
proxy.golang.org: github.com/pyrra-dev/pyrra
  • Versions: 42
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Stargazers count: 2.2%
Forks count: 3.3%
Average: 4.0%
Dependent repos count: 4.7%
Dependent packages count: 5.8%
Last synced: 6 months ago

Dependencies

.github/workflows/golangci-lint.yml actions
  • actions/checkout 755da8c3cf115ac066823e79a1e1788f8940201b composite
  • actions/setup-go v3 composite
  • golangci/golangci-lint-action v3.3.1 composite
.github/workflows/container.yaml actions
  • actions/checkout 755da8c3cf115ac066823e79a1e1788f8940201b composite
  • actions/download-artifact 9782bd6a9848b53b110e712e20e42d89988822b7 composite
  • actions/setup-go 268d8c0ca0432bb2cf416faae41297df9d262d7f composite
  • actions/setup-node 8c91899e586c5b171469028077307d293428b516 composite
  • actions/upload-artifact 83fd05a356d7e2593de66fc9913b3002723633cb composite
  • docker/build-push-action c56af957549030174b10d6867f20e78cfd7debc5 composite
  • docker/login-action f4ef78c080cd8ba55a85445d5b36e214a81df20a composite
  • docker/metadata-action 57396166ad8aefe6098280995947635806a0e6ea composite
  • docker/setup-buildx-action 8c0edbc76e98fa90f69d9a2c020dcb50019dc325 composite
  • docker/setup-qemu-action e81a89b1732b9c48d79cd809d8d81d79c4647a18 composite
  • goreleaser/goreleaser-action 8f67e590f2d095516493f017008adc464e63adb1 composite
.github/workflows/go.yaml actions
  • actions/checkout 755da8c3cf115ac066823e79a1e1788f8940201b composite
  • actions/setup-go v3 composite
.github/workflows/release.yml actions
  • actions/checkout 755da8c3cf115ac066823e79a1e1788f8940201b composite
  • actions/download-artifact 9782bd6a9848b53b110e712e20e42d89988822b7 composite
  • actions/setup-go 268d8c0ca0432bb2cf416faae41297df9d262d7f composite
  • actions/setup-node 8c91899e586c5b171469028077307d293428b516 composite
  • actions/upload-artifact 83fd05a356d7e2593de66fc9913b3002723633cb composite
  • docker/build-push-action c56af957549030174b10d6867f20e78cfd7debc5 composite
  • docker/login-action f4ef78c080cd8ba55a85445d5b36e214a81df20a composite
  • docker/metadata-action 57396166ad8aefe6098280995947635806a0e6ea composite
  • docker/setup-buildx-action 8c0edbc76e98fa90f69d9a2c020dcb50019dc325 composite
  • docker/setup-qemu-action e81a89b1732b9c48d79cd809d8d81d79c4647a18 composite
  • goreleaser/goreleaser-action 8f67e590f2d095516493f017008adc464e63adb1 composite
Dockerfile docker
  • docker.io/alpine 3.17.1 build
  • docker.io/busybox 1.35.0 build
go.mod go
  • github.com/alecthomas/kong v0.7.0
  • github.com/beorn7/perks v1.0.1
  • github.com/bufbuild/connect-go v1.4.1
  • github.com/cespare/xxhash/v2 v2.2.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/dennwc/varint v1.0.0
  • github.com/dgraph-io/ristretto v0.1.1
  • github.com/dustin/go-humanize v1.0.0
  • github.com/emicklei/go-restful/v3 v3.10.1
  • github.com/evanphx/json-patch/v5 v5.6.0
  • github.com/fsnotify/fsnotify v1.6.0
  • github.com/go-chi/chi/v5 v5.0.8
  • github.com/go-chi/cors v1.2.1
  • github.com/go-kit/log v0.2.1
  • github.com/go-logfmt/logfmt v0.5.1
  • github.com/go-logr/logr v1.2.3
  • github.com/go-logr/zapr v1.2.3
  • github.com/go-openapi/jsonpointer v0.19.5
  • github.com/go-openapi/jsonreference v0.20.0
  • github.com/go-openapi/swag v0.22.3
  • github.com/gogo/protobuf v1.3.2
  • github.com/golang/glog v1.0.0
  • github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
  • github.com/golang/protobuf v1.5.2
  • github.com/google/gnostic v0.6.9
  • github.com/google/go-cmp v0.5.9
  • github.com/google/gofuzz v1.2.0
  • github.com/google/uuid v1.3.0
  • github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd
  • github.com/imdario/mergo v0.3.13
  • github.com/josharian/intern v1.0.0
  • github.com/jpillora/backoff v1.0.0
  • github.com/json-iterator/go v1.1.12
  • github.com/mailru/easyjson v0.7.7
  • github.com/matttproud/golang_protobuf_extensions v1.0.4
  • github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
  • github.com/modern-go/reflect2 v1.0.2
  • github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
  • github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
  • github.com/oklog/run v1.1.0
  • github.com/pkg/errors v0.9.1
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/polarsignals/connect-go-prometheus v0.0.0-20221202180953-626537f1f6bc
  • github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.60.1
  • github.com/prometheus/client_golang v1.14.0
  • github.com/prometheus/client_model v0.3.0
  • github.com/prometheus/common v0.39.0
  • github.com/prometheus/procfs v0.9.0
  • github.com/prometheus/prometheus v0.41.0
  • github.com/spf13/pflag v1.0.5
  • github.com/stretchr/testify v1.8.1
  • go.uber.org/atomic v1.10.0
  • go.uber.org/goleak v1.2.0
  • go.uber.org/multierr v1.6.0
  • go.uber.org/zap v1.24.0
  • golang.org/x/exp v0.0.0-20221212164502-fae10dda9338
  • golang.org/x/net v0.4.0
  • golang.org/x/oauth2 v0.3.0
  • golang.org/x/sys v0.3.0
  • golang.org/x/term v0.3.0
  • golang.org/x/text v0.5.0
  • golang.org/x/time v0.3.0
  • gomodules.xyz/jsonpatch/v2 v2.2.0
  • google.golang.org/appengine v1.6.7
  • google.golang.org/protobuf v1.28.1
  • gopkg.in/inf.v0 v0.9.1
  • gopkg.in/yaml.v2 v2.4.0
  • gopkg.in/yaml.v3 v3.0.1
  • k8s.io/api v0.26.0
  • k8s.io/apiextensions-apiserver v0.26.0
  • k8s.io/apimachinery v0.26.0
  • k8s.io/client-go v0.26.0
  • k8s.io/component-base v0.26.0
  • k8s.io/klog/v2 v2.80.1
  • k8s.io/kube-openapi v0.0.0-20221207184640-f3cff1453715
  • k8s.io/utils v0.0.0-20221128185143-99ec85e7a448
  • sigs.k8s.io/controller-runtime v0.14.1
  • sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd
  • sigs.k8s.io/structured-merge-diff/v4 v4.2.3
  • sigs.k8s.io/yaml v1.3.0
go.sum go
  • 283 dependencies
ui/package-lock.json npm
  • 1190 dependencies
ui/package.json npm
  • @bufbuild/connect-web ^0.2.1 development
  • @bufbuild/protobuf ^0.1.1 development
  • @bufbuild/protoc-gen-connect-web ^0.2.1 development
  • @bufbuild/protoc-gen-es ^0.1.1 development
  • @fontsource/inter ^4.5.14 development
  • @fontsource/lato ^4.5.10 development
  • @types/node ^18.11.8 development
  • @types/react ^18.0.21 development
  • @types/react-dom ^18.0.8 development
  • cra-template-typescript ^1.2.0 development
  • eslint ^7.32.0 development
  • eslint-config-prettier ^8.5.0 development
  • eslint-config-standard-with-typescript ^21.0.1 development
  • eslint-plugin-import ^2.26.0 development
  • eslint-plugin-prettier ^4.2.1 development
  • eslint-plugin-react ^7.31.10 development
  • eslint-plugin-react-hooks ^4.6.0 development
  • prettier ^2.7.1 development
  • react-scripts 5.0.1 development
  • sass ^1.56.2 development
  • typescript ^4.8.4 development
  • bootstrap ^5.2.2
  • react ^18.1.0
  • react-bootstrap ^2.5.0
  • react-dom ^18.2.0
  • react-query ^3.39.2
  • react-router-dom ^6.4.2
  • uplot 1.6.22
  • uplot-react ^1.1.4
.github/workflows/dependabot-merge.yaml actions
  • dependabot/fetch-metadata v1 composite
.github/workflows/ui-test.yaml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/generate.yaml actions
  • actions/checkout v4 composite
  • actions/setup-go v4 composite
  • zendesk/setup-jsonnet v11 composite