Add multiple conditions with logic for AlertPolicy #218
Labels
enhancement
New feature or request
v2alpha1
Incompatible changes proposed for the next major release
Problem to solve
Currently, the specifications only allow for 1 condition to be specified in an AlertPolicy. This can be limiting, particularly when setting up multi-window alerts. There should be some ways to setup AND/OR logics for conditions.
Proposal
I think the easiest way to do it is to have an AND logic at the top level, like slogen is doing here: https://github.com/OpenSLO/slogen/blob/main/samples/sumologic/v1/alert-policy/burn-rate.yaml. For me that is the most "natural" assumption and it would also keep slogen in the spec without any change.
To support OR logic (and even more complex AND), we could have and or/and keyword. So it could look something like that:
which is roughly equivalent to the expression for the "page" level in the SRE workbook I just linked to:
Or you could simply have multiple conditions which all needs to be met, in which case you have to option to stay at the top level:
This will allow it to be backward compatible with the current v1 spec, will be compatible with what slogen does and will allow for more complex and/or logic expressions.
Further details
Briefly discussed previously here: #54 (comment)
Links / references
https://sre.google/workbook/alerting-on-slos/#6-multiwindow-multi-burn-rate-alerts
https://github.com/OpenSLO/slogen/blob/main/samples/sumologic/v1/alert-policy/burn-rate.yaml
The text was updated successfully, but these errors were encountered: