-
Notifications
You must be signed in to change notification settings - Fork 833
Handle forward slashes in ruler mapper/manager #2506
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
Handle forward slashes in ruler mapper/manager #2506
Conversation
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.
I'm not sure I understand the upgrade path. I assume there are already existing rule files. How do we handle those?
pkg/ruler/mapper.go
Outdated
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.
level.Warn(m.logger).Log("msg", "unable to remove rule file on disk", "file", existingFile.Name(), "err", err) | |
level.Warn(m.logger).Log("msg", "unable to remove rule file on disk", "file", fullFileName.Name(), "err", err) |
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.
These aren't rule files meant for the storage and persistence of rules. They are temporary files that are loaded by the upstream prometheus manager code for evaluation. They are essentially stateless so no upgrade path is required.
CHANGELOG.md
Outdated
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.
Shouldn't this be considered a CHANGE, mentioning that when we store rules in the filesystem we now base64 encode the filename?
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.
Makes sense
pkg/ruler/mapper.go
Outdated
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 main downside of this approach is that the encoded filename is unreadable and makes debugging harder. An alternative may be using url.PathEscape()
(as far as %
character is not a problem). Same examples:
Hello
>Hello
Hello world
>Hello%20world
a/b
>a%2Fb
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.
I like this better. This means the existing file names are same as well.
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.
This would only work for POSIX, no Windows. Will that be an issue?
d40e14f
to
1afd8e2
Compare
CHANGELOG.md
Outdated
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.
Sorry to bother you on this, but I think that reading the changelog entry it's not clear why it's a CHANGE. Could you clarify it?
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.
I need to give it more thought. I'm starting to think a changelog entry is not needed or if anything it should be labeled a BUGFIX since it aligns Cortex with expected behavior.
Signed-off-by: Jacob Lisi <[email protected]>
Signed-off-by: Jacob Lisi <[email protected]>
Signed-off-by: Jacob Lisi <[email protected]>
Signed-off-by: Jacob Lisi <[email protected]>
Signed-off-by: Jacob Lisi <[email protected]>
Signed-off-by: Jacob Lisi <[email protected]>
Signed-off-by: Jacob Lisi <[email protected]>
1afd8e2
to
52ae064
Compare
Signed-off-by: Jacob Lisi <[email protected]>
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.
Thanks @jtlisi for addressing my feedback. LGTM!
Signed-off-by: Jacob Lisi <[email protected]>
What this PR does:
/+<>?
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]