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

mimirtool rules sync: fix sync when query_offset or evaluation_delay change #8297

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

pracucci
Copy link
Collaborator

@pracucci pracucci commented Jun 6, 2024

What this PR does

This PR builds on #8295. While testing #8295 I've noticed that the rule group config is not re-synched if you only change query_offset or evaluation_delay. That's because we don't check these fields in the comparison.

This PR fixes it.

Which issue(s) this PR fixes or relates to

N/A

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@@ -132,6 +134,14 @@ func CompareGroups(groupOne, groupTwo rwrulefmt.RuleGroup) error {
return errDiffRWConfigs
}

if ((groupOne.EvaluationDelay == nil) != (groupTwo.EvaluationDelay == nil)) || (groupOne.EvaluationDelay != nil && groupTwo.EvaluationDelay != nil && *groupOne.EvaluationDelay != *groupTwo.EvaluationDelay) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

groupOne.EvaluationDelay == nil should be treated the same as groupOne.EvaluationDelay != nil && *groupOne.EvaluationDelay == 0 as we do not store the zero value, so the tool could get into an infinite loop trying to sync the 0 value.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I should have addressed it here: e9baaa2. It also allowed me to simplify the comparison.

Base automatically changed from update-mimir-prometheus to main June 7, 2024 06:36
…change

Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci pracucci marked this pull request as ready for review June 7, 2024 07:51
@pracucci pracucci requested a review from a team as a code owner June 7, 2024 07:51
@pracucci pracucci enabled auto-merge (squash) June 7, 2024 08:01
@pracucci pracucci merged commit 8ce49e3 into main Jun 7, 2024
29 checks passed
@pracucci pracucci deleted the fix-mimirtools-rules-sync branch June 7, 2024 08:08
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.

2 participants