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

feat: adjustable rule_group interval #515

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

wbollock
Copy link

@wbollock wbollock commented Jul 3, 2023

This allows for more expensive SLO recording rules by letting users
create a custom Prometheus rule_group.interval, as rule group default or per type of rule.

https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group

Now instead of all rule groups using the default global evaluation
interval, a custom interval can be set on all three types of recording rules
for an SLO.

If no interval is set then the global default will be assumed,
matching current Sloth behavior.

Resolves: #367

Edit: I didn't touch the kubernetes operator side and probably need adjustments there

wbollock and others added 9 commits June 13, 2023 20:00
This allows for more expensive SLO recording rules by letting users
create a custom Prometheus `rule_group.interval`.

https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group

Now instead of all rule groups using the default global evaluation
interval, a custom interval can be set on all sets of recording rules
for an SLO.

If no `interval` is set then the global default will be assumed,
matching current Sloth behavior.

Resolves: slok#367
Related to how the unit test coverage works, this will make sure
RuleGroupInterval is not appended to RuleGroups unless it is defined and
not empty.

Not requring the `yaml` file does an okay job of this but expliclity
writing the rules without RuleGroupInterval is safer.

It's a bit ugly and repetitive but I think that's just how Go works..
This updates tests include `interval`'s and also includes a test to make
sure the rules render correctly when interval is not included.
Instead of a singular global default, now a rule_group interval can be
set for every individual type of rule_group Sloth generates.

The generic, `interval:all` rule will also stay and can "fill in" any missing per-rule
group defaults. Along with the default behavior of doing nothing if no
`interval` is specified.
Specific ones and general/specific combined
Co-authored-by: Will Hegedus <will@wbhegedus.me>
@wbollock
Copy link
Author

wbollock commented Oct 9, 2023

@slok when you have a chance could you take a look and let me know what you think?

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.

Add ability to specify rule group interval
1 participant