{"id":13696861,"url":"https://github.com/google/slo-generator","last_synced_at":"2025-05-14T17:02:45.843Z","repository":{"id":37770991,"uuid":"298523333","full_name":"google/slo-generator","owner":"google","description":"SLO Generator computes SLIs, SLOs, Error Budgets and Burn Rates from supported backends, then exports an SLO report to supported targets.","archived":false,"fork":false,"pushed_at":"2025-04-16T08:56:54.000Z","size":1337,"stargazers_count":515,"open_issues_count":84,"forks_count":81,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-19T22:27:38.617Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-25T09:08:42.000Z","updated_at":"2025-04-16T12:49:08.000Z","dependencies_parsed_at":"2024-06-18T22:36:35.831Z","dependency_job_id":"729016e0-e3a8-4c2a-8f40-f4c1a067325b","html_url":"https://github.com/google/slo-generator","commit_stats":{"total_commits":266,"total_committers":30,"mean_commits":8.866666666666667,"dds":"0.31954887218045114","last_synced_commit":"0007bebcd21f172a168e93d41bd170648a67ae55"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fslo-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fslo-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fslo-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fslo-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/slo-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190368,"owners_count":22029631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T18:00:48.692Z","updated_at":"2025-05-14T17:02:45.749Z","avatar_url":"https://github.com/google.png","language":"Python","readme":"# SLO Generator\n\n![test](https://github.com/google/slo-generator/workflows/test/badge.svg)\n![build](https://github.com/google/slo-generator/workflows/build/badge.svg)\n![deploy](https://github.com/google/slo-generator/workflows/deploy/badge.svg)\n[![PyPI version](https://badge.fury.io/py/slo-generator.svg)](https://badge.fury.io/py/slo-generator)\n[![Downloads](https://static.pepy.tech/personalized-badge/slo-generator?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=orange\u0026left_text=pypi%20downloads)](https://pepy.tech/project/slo-generator)\n\n`slo-generator` is a tool to compute and export **Service Level Objectives** ([SLOs](https://landing.google.com/sre/sre-book/chapters/service-level-objectives/)), **Error Budgets** and **Burn Rates**, using configurations written in YAML (or JSON) format.\n\n***IMPORTANT NOTE: the following content is the `slo-generator` v2 documentation. The v1 documentation is available [here](https://github.com/google/slo-generator/tree/v1.5.1), and instructions to migrate to v2 are available [here](https://github.com/google/slo-generator/blob/master/docs/shared/migration.md).***\n\n## Table of contents\n\n- [Description](#description)\n- [Local usage](#local-usage)\n  - [Requirements](#requirements)\n  - [Installation](#installation)\n  - [CLI usage](#cli-usage)\n  - [API usage](#api-usage)\n- [Configuration](#configuration)\n  - [SLO configuration](#slo-configuration)\n  - [Shared configuration](#shared-configuration)\n- [More documentation](#more-documentation)\n  - [Build an SLO achievements report with BigQuery and DataStudio](#build-an-slo-achievements-report-with-bigquery-and-datastudio)\n  - [Deploy the SLO Generator in Cloud Run](#deploy-the-slo-generator-in-cloud-run)\n  - [Deploy the SLO Generator in Kubernetes (Alpha)](#deploy-the-slo-generator-in-kubernetes-alpha)\n  - [Deploy the SLO Generator in a CloudBuild pipeline](#deploy-the-slo-generator-in-a-cloudbuild-pipeline)\n  - [DEPRECATED: Deploy the SLO Generator on Google Cloud Functions (Terraform)](#deprecated-deploy-the-slo-generator-on-google-cloud-functions-terraform)\n  - [Contribute to the SLO Generator](#contribute-to-the-slo-generator)\n\n## Description\n\nThe `slo-generator` runs backend queries computing **Service Level Indicators**, compares them with the **Service Level Objectives** defined and generates a report by computing important metrics:\n\n- **Service Level Indicator** (SLI) defined as **SLI = N\u003csub\u003egood_events\u003c/sub\u003e \u0026#47; N\u003csub\u003evalid_events\u003c/sub\u003e**\n- **Error Budget** (EB) defined as **EB = 1 - SLI**\n- **Error Budget Burn Rate** (EBBR) defined as **EBBR = EB / EB\u003csub\u003etarget\u003c/sub\u003e**\n- **... and more**, see the [example SLO report](./test/unit/../../tests/unit/fixtures/slo_report_v2.json).\n\nThe **Error Budget Burn Rate** is often used for [**alerting on SLOs**](https://sre.google/workbook/alerting-on-slos/), as it demonstrates in practice to be more **reliable** and **stable** than alerting directly on metrics or on **SLI \u003e SLO** thresholds.\n\n## Local usage\n\n### Requirements\n\n- `python3.8` and above\n- `pip3`\n\n### Installation\n\n`slo-generator` is a Python library published on [PyPI](https://pypi.org). To install it, run:\n\n```sh\npip3 install slo-generator\n```\n\n***Notes:***\n\n- To install **[providers](./docs/providers)**, use `pip3 install slo-generator[\u003cPROVIDER_1\u003e, \u003cPROVIDER_2\u003e, ... \u003cPROVIDER_n]`. For instance:\n  - `pip3 install slo-generator[cloud_monitoring]` installs the Cloud Monitoring backend / exporter.\n  - `pip3 install slo-generator[prometheus, datadog, dynatrace]` install the Prometheus, Datadog and Dynatrace, backends / exporters.\n- To install the **slo-generator API**, run `pip3 install slo-generator[api]`.\n- To enable **debug logs**, set the environment variable `DEBUG` to `1`.\n- To enable **colorized output** (local usage), set the environment variable `COLORED_OUTPUT` to `1`.\n\n### CLI usage\n\nTo compute an SLO report using the CLI, run:\n\n```sh\nslo-generator compute -f \u003cSLO_CONFIG_PATH\u003e -c \u003cSHARED_CONFIG_PATH\u003e --export\n```\n\nwhere:\n\n- `\u003cSLO_CONFIG_PATH\u003e` is the [SLO configuration](#slo-configuration) file or folder path.\n- `\u003cSHARED_CONFIG_PATH\u003e` is the [Shared configuration](#shared-configuration) file path.\n- `--export` | `-e` enables exporting data using the `exporters` specified in the SLO\n  configuration file.\n\nUse `slo-generator compute --help` to list all available arguments.\n\n### API usage\n\nOn top of the CLI, the `slo-generator` can also be run as an API using the Cloud Functions Framework SDK (Flask) using the `api` subcommand:\n\n```sh\nslo-generator api --config \u003cSHARED_CONFIG_PATH\u003e\n```\n\nwhere:\n\n- `\u003cSHARED_CONFIG_PATH\u003e` is the [Shared configuration](#shared-configuration) file path or GCS URL.\n\nOnce the API is up-and-running, you can make HTTP POST requests with your SLO configurations (YAML or JSON) in the request body:\n\n```sh\ncurl -X POST -H \"Content-Type: text/x-yaml\" --data-binary @slo.yaml localhost:8080 # yaml SLO config\ncurl -X POST -H \"Content-Type: application/json\" -d @slo.json localhost:8080 # json SLO config\n```\n\nTo read more about the API and advanced usage, see [docs/shared/api.md](./docs/shared/api.md).\n\n## Configuration\n\nThe `slo-generator` requires two configuration files to run, an **SLO configuration** file, describing your SLO, and the **Shared configuration** file (common configuration for all SLOs).\n\n### SLO configuration\n\nThe **SLO configuration** (JSON or YAML) is following the Kubernetes format and is composed of the following fields:\n\n- `api`: `sre.google.com/v2`\n- `kind`: `ServiceLevelObjective`\n- `metadata`:\n  - `name`: [**required**] *string* - Full SLO name (**MUST** be unique).\n  - `labels`: [*optional*] *map* - Metadata labels, **for example**:\n    - `slo_name`: SLO name (e.g `availability`, `latency128ms`, ...).\n    - `service_name`: Monitored service (to group SLOs by service).\n    - `feature_name`: Monitored feature (to group SLOs by feature).\n\n- `spec`:\n  - `description`: [**required**] *string* - Description of this SLO.\n  - `goal`: [**required**] *string* - SLO goal (or target) (**MUST** be between 0 and 1).\n  - `backend`: [**required**] *string* - Backend name (**MUST** exist in SLO Generator Configuration).\n  - `method`: [**required**] *string* - Backend method to use (**MUST** exist in backend class definition).\n  - `service_level_indicator`: [**required**] *map* - SLI configuration. The content of this section is\n  specific to each provider, see [`docs/providers`](./docs/providers).\n  - `error_budget_policy`: [*optional*] *string* - Error budget policy name\n  (**MUST** exist in SLO Generator Configuration). If not specified, defaults to `default`.\n  - `exporters`: [*optional*] *string* - List of exporter names (**MUST** exist in SLO Generator Configuration).\n\n***Note:*** *you can use environment variables in your SLO configs by using `${MY_ENV_VAR}` syntax to avoid having sensitive data in version control. Environment variables will be replaced automatically at run time.*\n\n**\u0026rarr; See [example SLO configuration](samples/cloud_monitoring/slo_gae_app_availability.yaml).**\n\n### Shared configuration\n\nThe shared configuration (JSON or YAML) configures the `slo-generator` and acts as a shared config for all SLO configs. It is composed of the following fields:\n\n- `backends`: [**required**] *map* - Data backends configurations. Each backend alias is defined as a key `\u003cbackend_name\u003e/\u003csuffix\u003e`, and a configuration map.\n\n  ```yaml\n  backends:\n    cloud_monitoring/dev:\n      project_id: proj-cm-dev-a4b7\n    datadog/test:\n      app_key: ${APP_SECRET_KEY}\n      api_key: ${API_SECRET_KEY}\n  ```\n\n  See specific providers documentation for detailed configuration:\n  - [`cloud_monitoring`](docs/providers/cloud_monitoring.md#backend)\n  - [`cloud_service_monitoring`](docs/providers/cloud_service_monitoring.md#backend)\n  - [`prometheus`](docs/providers/prometheus.md#backend)\n  - [`elasticsearch`](docs/providers/elasticsearch.md#backend)\n  - [`datadog`](docs/providers/datadog.md#backend)\n  - [`dynatrace`](docs/providers/dynatrace.md#backend)\n  - [`\u003ccustom\u003e`](docs/providers/custom.md#backend)\n\n- `exporters`: A map of exporters to export results to. Each exporter is defined as a key formatted as `\u003cexporter_name\u003e/\u003coptional_suffix\u003e`, and a map value detailing the exporter configuration.\n\n  ```yaml\n  exporters:\n    bigquery/dev:\n      project_id: proj-bq-dev-a4b7\n      dataset_id: my-test-dataset\n      table_id: my-test-table\n    prometheus:\n      url: ${PROMETHEUS_URL}\n  ```\n\n  See specific providers documentation for detailed configuration:\n  - [`bigquery`](docs/providers/bigquery.md#exporter) to export SLO reports to BigQuery for historical analysis and DataStudio reporting.\n  - [`cloudevent`](docs/providers/cloudevent.md#exporter) to stream SLO reports to Cloudevent receivers.\n  - [`pubsub`](docs/providers/pubsub.md#exporter) to stream SLO reports to Pubsub.\n  - [`cloud_monitoring`](docs/providers/cloud_monitoring.md#exporter) to export metrics to Cloud Monitoring.\n  - [`prometheus`](docs/providers/prometheus.md#exporter) to export metrics to Prometheus.\n  - [`datadog`](docs/providers/datadog.md#exporter) to export metrics to Datadog.\n  - [`dynatrace`](docs/providers/dynatrace.md#exporter) to export metrics to Dynatrace.\n  - [`\u003ccustom\u003e`](docs/providers/custom.md#exporter) to export SLO data or metrics to a custom destination.\n\n- `error_budget_policies`: [**required**] A map of various error budget policies.\n  - `\u003cebp_name\u003e`: Name of the error budget policy.\n    - `steps`: List of error budget policy steps, each containing the following fields:\n      - `window`: Rolling time window for this error budget.\n      - `alerting_burn_rate_threshold`: Target burnrate threshold over which alerting is needed.\n      - `urgent_notification`: boolean whether violating this error budget should trigger a page.\n      - `overburned_consequence_message`: message to show when the error budget is above the target.\n      - `achieved_consequence_message`: message to show when the error budget is within the target.\n\n  ```yaml\n  error_budget_policies:\n    default:\n      steps:\n      - name: 1 hour\n        burn_rate_threshold: 9\n        alert: true\n        message_alert: Page to defend the SLO\n        message_ok: Last hour on track\n        window: 3600\n      - name: 12 hours\n        burn_rate_threshold: 3\n        alert: true\n        message_alert: Page to defend the SLO\n        message_ok: Last 12 hours on track\n        window: 43200\n  ```\n\n**\u0026rarr; See [example Shared configuration](samples/config.yaml).**\n\n## More documentation\n\nTo go further with the SLO Generator, you can read:\n\n### [Build an SLO achievements report with BigQuery and DataStudio](docs/deploy/datastudio_slo_report.md)\n\n### [Deploy the SLO Generator in Cloud Run](docs/deploy/cloudrun.md)\n\n### [Deploy the SLO Generator in Kubernetes (Alpha)](docs/deploy/kubernetes.md)\n\n### [Deploy the SLO Generator in a CloudBuild pipeline](docs/deploy/cloudbuild.md)\n\n### [DEPRECATED: Deploy the SLO Generator on Google Cloud Functions (Terraform)](docs/deploy/cloudfunctions.md)\n\n### [Contribute to the SLO Generator](CONTRIBUTING.md)\n","funding_links":[],"categories":["11. Tools","Tools","📊 SLIs, SLOs e SLAs"],"sub_categories":["Ferramentas"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fslo-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fslo-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fslo-generator/lists"}