VictoriaMetrics/app/vmalert/notifier
Roman Khavronenko d0d0be9031
vmalert: do not execute templates during validation (#2528)
Function `ValidateTemplates`, used on the vmalert startup,
is supposed to check whether used templates and functions
in loaded rules are correct. The function was parsing
and executing loaded templates.
However, rules may contain functions which can't be executed
without values (label values or query results), like `slice`.
Because of this, validation for completely valid expression
`{{ slice $labels.job 9 }}` will fail since `$labels.job`
is empty during validation.

This PR updates `ValidateTemplates` function to only parse
templates without executing them.

https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2514
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2022-05-02 15:37:54 +03:00
..
testdata vmalert: add DNS service discovery (#2465) 2022-04-13 14:14:25 +03:00
alert.go vmalert: do not execute templates during validation (#2528) 2022-05-02 15:37:54 +03:00
alert_test.go vmalert: support relabeling for alert labels sent via notifier 2022-04-11 12:12:04 +03:00
alertmanager.go vmalert: support relabeling for alert labels sent via notifier 2022-04-11 12:12:04 +03:00
alertmanager_request.qtpl vmalert: support relabeling for alert labels sent via notifier 2022-04-11 12:12:04 +03:00
alertmanager_request.qtpl.go vmctl/vm: added datapoints collection bar (#2486) 2022-05-02 10:58:06 +03:00
alertmanager_test.go vmalert: support relabeling for alert labels sent via notifier 2022-04-11 12:12:04 +03:00
config.go lib/promscrape: follow-up after baa1c24b36 2022-04-16 14:26:38 +03:00
config_test.go vmalert: add DNS service discovery (#2465) 2022-04-13 14:14:25 +03:00
config_watcher.go vmalert: add DNS service discovery (#2465) 2022-04-13 14:14:25 +03:00
config_watcher_test.go Consul SD - update services on the watcher's start (#2202) 2022-02-21 15:33:33 +02:00
init.go vmalert: add DNS service discovery (#2465) 2022-04-13 14:14:25 +03:00
notifier.go vmalert: support configuration file for notifiers (#2127) 2022-02-02 23:42:25 +02:00
package_test.go Support of custom URL path for alert (#560) 2020-06-21 16:33:58 +03:00
template_func.go Vmalert compliance improvements (#2320) 2022-03-16 13:22:26 +02:00