/slo-cue

Generate Prometheus alerting & recording rules for SLOs using CUE.

Primary LanguageCUEApache License 2.0Apache-2.0

SLO CUE

Generate Prometheus alerting & recording rules for SLOs with CUE.

Highly experimental!

Usage

First, a service must be defined with associated SLOs.

import (
	"github.com/cbrgm/slo-cue/schema"
)

services: schema.#ServiceDefinition

services: "foo_service": [
	{
		name:        "read"
		errorsQuery: "sum(rate(promhttp_metric_handler_requests_total{namespace='default',job='fooapp',code=~'5..'}[$__range]))"
		totalQuery:  "sum(rate(promhttp_metric_handler_requests_total{namespace='default',job='fooapp'}[$__range]))"
		threshold:   0.999
	}
]

This service definition must be saved in the tools folder (for example as foo_service.cue).

Dump the Prometheus Alerting & Recording Rules as JSON.

cd tools && cue dumpjson

or as yaml

cd tools && cue dump

Acknowledgements

This project was inspired by

Literature:

Contributing & License

Feel free to submit changes! See the Contributing Guide. This project is open-source and is developed under the terms of the Apache 2.0 License.