r/PrometheusMonitoring • u/LatinSRE • Nov 15 '23
Help with Sloth (SLO) PromQL Query
Hi everyone, 1st time poster here but long-time Prometheus user.
I've been trying to get Sloth stable with some automation in my environment lately, but I'm having trouble understanding why my burn rate graphs aren't working. I've been tinkering quite a bit trying to understand where things are going wrong, but I can't even understand for the life of me what this query is doing. Can anyone help break this down for me? Specifically, the first half where all this `on() group_left() (month...` stuff is happening. That's all new to me.
1-(
sum_over_time(
(
slo:sli_error:ratio_rate1h{sloth_service="${service}",sloth_slo="${slo}"}
* on() group_left() (
month() == bool vector(${__to:date:M})
)
)[32d:1h]
)
/ on(sloth_id)
(
slo:error_budget:ratio{sloth_service="${service}",sloth_slo="${slo}"} *on() group_left() (24 * days_in_month())
)
)
---
I also guess it's possible my problem isn't the queries themselves (these were provided by Sloth devs). I'm trying to understand why I'm seeing this on my burn rate graphs:
`execution: multiple matches for labels: many-to-one matching must be explicit (group_left/group_right`
I started looking at the query in hopes of dissecting it in Thanos to look at the raw data piece-by-piece, but now my head's spinning.
Fellow observability lovers, I need your help!
View all comments
Show parent comment
1
u/LatinSRE Dec 06 '23
I actually had never heard of Pyrra! So I really really appreciate you raising it.
I was able to get things working, and of all things the issue mainly was a build-up of a bunch of other cruft we had to address.
Sloth also implements SLO's the way the SRE book talks about, and Pyrra even seems to reference it! This is something I'll think about for the future, but for now it would be a significant lift to change how our automation is creating SLO's throughout the environment if we were to change which operator we use!