Skip to content
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

Merged
merged 2 commits into from
Aug 16, 2023

Conversation

abestel
Copy link

@abestel abestel commented Aug 9, 2023

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).

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).
Copy link
Member

@metalmatze metalmatze left a 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
Comment on lines 557 to 558
} else if n.Name == "successMetric" {
n.Name = r.successMetric
Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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.

Copy link
Member

@metalmatze metalmatze left a 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!

@metalmatze metalmatze merged commit e5897fe into pyrra-dev:main Aug 16, 2023
6 checks passed
@abestel abestel deleted the fix/generic_rules_bool_gauge branch December 7, 2023 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants