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

Rule: Fix temporary rule filename composition issue #4468

Merged
merged 4 commits into from
Jul 29, 2021

Conversation

matej-g
Copy link
Collaborator

@matej-g matej-g commented Jul 22, 2021

Signed-off-by: Matej Gera [email protected]

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Provides a fix for current issue with rule filenames, which are being written into a .tmp-rules directory for further processing. As was discovered in the linked issue, the current implementation could lead to temporary rule filenames being composed in a way, where trimming of the filename leads to unexpected result, i.e. the TrimLeft function can in some cases trim the filename in a way which results in duplication of temporary rule filenames. This in turn manifests itself as some rules being 'ignored' by the rule component.

Since trimming the filename does not seem to have the desired effect, the fix proposed here is to simply leave the full filename as is, which practically leads to same result but without possible name duplication issue.

Fixes #4232

Verification

Related tests have been updated to assess the fix is working; also tested manually with local run of thanos rule

@matej-g matej-g changed the title rule: Fix rules filename composition issue rule: Fix temporary rules filename composition issue Jul 22, 2021
@matej-g matej-g changed the title rule: Fix temporary rules filename composition issue Rule: Fix temporary rules filename composition issue Jul 22, 2021
@matej-g matej-g changed the title Rule: Fix temporary rules filename composition issue Rule: Fix temporary rule filename composition issue Jul 22, 2021
Signed-off-by: Matej Gera <[email protected]>
wiardvanrij
wiardvanrij previously approved these changes Jul 28, 2021
Copy link
Member

@wiardvanrij wiardvanrij left a comment

Choose a reason for hiding this comment

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

If you could rebase this from main, that would be great. LGTM, thank you

GiedriusS
GiedriusS previously approved these changes Jul 29, 2021
@GiedriusS GiedriusS dismissed stale reviews from wiardvanrij and themself via a8ccc3d July 29, 2021 14:19
@GiedriusS
Copy link
Member

LGTM, I have fixed the conflicts!

@GiedriusS GiedriusS enabled auto-merge (squash) July 29, 2021 14:20
@GiedriusS GiedriusS disabled auto-merge July 29, 2021 15:21
GiedriusS
GiedriusS previously approved these changes Jul 29, 2021
Signed-off-by: Giedrius Statkevičius <[email protected]>
@GiedriusS GiedriusS enabled auto-merge (squash) July 29, 2021 15:23
@GiedriusS GiedriusS merged commit aa148f8 into thanos-io:main Jul 29, 2021
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.

Ruler: skips rule files based on their names without any error/warning log.
3 participants