slok / sloth

🦥 Easy and simple Prometheus SLO (service level objectives) generator
https://sloth.dev
Apache License 2.0
2.06k stars 169 forks source link

Support Loki and LogQL alongside Prometheus #280

Open proffalken opened 2 years ago

proffalken commented 2 years ago

Hello!

We're ingesting a significant amount of data via logging and it would be great to be able to create SLI's and SLO's based on LogQL syntax for Loki as well as PromQL.

It all seems to work apart from the point at which Sloth tries to validate that the logql is valid promql, at which point it falls apart rapidly!

Is there any way Sloth could try and validate against https://github.com/grafana/loki/blob/main/pkg/logql/syntax/parser.go as well as against the Prom parser?

slok commented 2 years ago

Hi @proffalken

Sloth's main focus is Prometheus, however, there have been some other requests about this: https://github.com/slok/sloth/issues/255

The problem of start supporting both is that we would need to start maintaining both and as you can see in the other comment, the Kubernetes operator would need tweaks.

I will think about maybe adding an option for the parsing side or adding support for configmap style, or both.

Thanks!

proffalken commented 2 years ago

Thanks @slok - For now we've written something internally in Python that almost replicates Sloth for Loki, but it would be great to not need to maintain it and somehow get similar functionality in Sloth instead!

jleloup commented 1 year ago

Would using Loki metrics generator be a suitable solution for this problem ?

My understanding is that SLOs & SLAs are numeric by nature, thus having a first step transforming log events into metrics before computing an SLO feels like a valid approach.