-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic Rules for Bool Gauge SLOs #849
Generic Rules for Bool Gauge SLOs #849
Conversation
When trying to define a bool_gauge SLO with generic rules enabled, the resulting prometheus rule CRD is invalid as the generic rule group is empty. This adds support for generic rules for bool gauges SLOs. It also changes the definition of bool_gauge SLO a bit, by making grouping optional (in line with the rest of the SLOs definitions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks for taking care of this.
Just one small comment to follow a convention.
slo/promql.go
Outdated
} else if n.Name == "successMetric" { | ||
n.Name = r.successMetric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far it worked quite well to actually reuse the errorMetric for the other way around case of a successMetric too. It's probably possible here too. I get that naming the metric and matchers error
isn't ideal in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I will revert this. I got a bit confused while doing this, but it's mostly because I'm not really familiar with Go overall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming is definitely not clean. The error
should be named something else. It's really just the compare metric we compare against the total. 🤷♂️ Maybe that might be a good internal name at some point: compare
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Thank you so much for this valuable contribution!
When trying to define a bool_gauge SLO with generic rules enabled, the resulting prometheus rule CRD is invalid as the generic rule group is empty.
This adds support for generic rules for bool gauges SLOs.
It also changes the definition of bool_gauge SLO a bit, by making grouping optional (in line with the rest of the SLOs definitions).