-
Notifications
You must be signed in to change notification settings - Fork 301
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
Markdown summary table #415
Conversation
Added documentation for the configuration options related to the markdown summary table. These options include: - summary_table_type (Defaults to ascii) - summary_prefix - summary_suffix Also fixed one too many newline chars at the end of the markdown table.
Added a short description of the possible summary_table_types to the documentation of the aggregation parameter.
This looks useful! I see a few formating typos in the docs, should be formatting. Thanks for fixing that preview/suffix bug - I guess no one uses that feature, or just chose to put up with the suffix not showing up. As far as unit testing goes, take a look at |
Fixed formating vs formatting typo.
Fixed the formating vs formatting typos. The suffix/prefix thing might not be used widely, because as far as I can tell it was never part of the documentation. Likely only people who stare at code know it. Thanks for the unit test pointer. Will look into this over the next days. |
Added unit tests to check the new markdown style aggregation summary table, the old and now default text table and the summary table prefix and suffix values.
Added a newline after a non-empty summary_prefix to ensure there is a linebreak between the set summary_prefix and the hardcoded 'Aggregation resulted in the following data...' table header.
Added a unit test for the changes. Based on that I spotted and fixed a small bug in the usage of summary_prefix. If you would set a summary_prefix value, it would have resulted in a header like this:
Now I ensure a newline, if there is a value for summary_prefix set:
It could be a worthwhile discussion though, whether this "Aggregation resulted in..." should probably just become the default prefix value and should be replaced by a custom prefix, if set, instead of having both. |
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.
Nice work on the unit tests and fixing the prefix newline issue.
Description
Added support for using markdown format for aggregation summary tables. I introduced the config option
summary_table_type
with the optionsascii
andmarkdown
to control the behavior. Within the code I fall back to the default of ascii, if the type is not specified. Therefore there are no breaking changes.Checklist
make test-docker
with my changes.Questions or Comments
Honestly, I'm not sure how a unit test for a different aggregation table formatting had to look like. Never done one before. I have tested the code by deploying it to my local ElastAlert instance and then raising alerts to my TheHive instance, which supports markdown for the alert styling and the alerts are properly formatted in there.
If you have any advise how to approach such a unit test, I'm happy to try to come up with something. 😄