Check and log when mandatory event fields are missing or empty
Add check for the case when configuration and/or Prometheus alert content would lead to empty values for mandatory Canopsis event attributes.
-
A mandatory event field is missing from config
-
A mandatory event field should be filled by a "value" (dynamic content taken from Prometheus alert) but the value is not found or empty in alert
Examples:
- value leads to a nonexistent field (a label or annotation that does not exist in some alerts)
- value leads to existing field but field is set to
null
or an empty string
Issue a warning when the case is met, such as:
WARNING - No value for field "connector_name": value "labels.somefield" not found or empty in source alert.
In logging level debug, the entire incoming alert should be written to log (if it's not already done).
Edited by Mathias Védrines