-
Notifications
You must be signed in to change notification settings - Fork 297
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
Make percentage_format_string support str.format() syntax #403
Make percentage_format_string support str.format() syntax #403
Conversation
elastalert/ruletypes.py
Outdated
@@ -1308,3 +1308,9 @@ def percentage_violation(self, match_percentage): | |||
if 'min_percentage' in self.rules and match_percentage < self.rules['min_percentage']: | |||
return True | |||
return False | |||
|
|||
def format_string(self, format_config, target_value): |
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.
What do you think about moving this format_string() into a util class so that it doesn't get repeated here?
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.
Working on 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.
Moved format_string() to util.py and added tests for the function accordingly
…https://github.com/iamxeph/elastalert2 into feature_add_support_format_syntax_to_percentagematch
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!
Description
This PR make percentage_format_string support str.format() syntax in addition to old %-format syntax.
Checklist
make test-docker
with my changes.Questions or Comments