grafana/pkg/services/ngalert/state/template
George Robinson ed7d29f2b9
Alerting: Migrate old alerting templates to Go templates (#62911)
* Migrate old alerting templates to use $labels

* Fix imports

* Add test coverage and separate rewriting to Go templates

* Fix lint

* Check for additional closing braces

* Add logging of invalid message templates

* Fix tests

* Small fixes

* Update comments

* Panic on empty token

* Use logtest.Fake

* Fix lint

* Allow for spaces in variable names by not tokenizing spaces

* Add template function to deduplicate Labels in a Value map

* Fix behavior of mapLookupString

* Reference deduplicated labels in migrated message template

* Fix behavior of deduplicateLabelsFunc

* Don't create variable for parent logger

* Add more tests for deduplicateLabelsFunc

* Remove unused function

* Apply suggestions from code review

Co-authored by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>

* Give label val merge function better name

* Extract template migration and escape literal tokens

* Consolidate + simplify template migration

---------

Co-authored-by: William Wernert <william.wernert@grafana.com>
2023-10-02 11:25:33 -04:00
..
funcs_test.go Alerting: Migrate old alerting templates to Go templates (#62911) 2023-10-02 11:25:33 -04:00
funcs.go Alerting: Migrate old alerting templates to Go templates (#62911) 2023-10-02 11:25:33 -04:00
template_test.go Alerting: Return errors when expanding templates (#63662) 2023-03-08 12:25:02 +00:00
template.go Alerting: do not expand template for labels\annotations if value is not a template (#71492) 2023-07-12 14:53:40 -04:00