Alerting: Evaluate data templating in alert rule name and message (#29908)

* evaluate Go style template

* inlince func

* add test case

* PR feedback and add tests for templte data map func

* Add test case

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* do regex check

* ensure ecape

* small cleanup

* dont exit on template execution errors

* add info tooltip

* add docs

* switch from go tmpl to regex

* update docs/comments

* update tooltip wording

* update docs wording

* add simple test

* avoid .MustCompile

* point to labels in docs

* update docs

* fix docs links

* remove line

* fix lint

* add note about multiple labels

* propagate labels for CM

* update docs

* remove whitespace

* update task title

* update docs

* pr feedback

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Will Browne
2021-01-19 22:02:44 +01:00
committed by GitHub
parent 446db193eb
commit c9da053e5d
9 changed files with 282 additions and 19 deletions

View File

@@ -8,7 +8,10 @@
<div class="gf-form-inline">
<div class="gf-form">
<span class="gf-form-label width-6">Name</span>
<input type="text" class="gf-form-input width-20" ng-model="ctrl.alert.name" />
<input type="text" class="gf-form-input width-20 gf-form-input--has-help-icon" ng-model="ctrl.alert.name" />
<info-popover mode="right-absolute">
If you want to apply templating to the alert rule name, you must use the following syntax - ${Label}
</info-popover>
</div>
<div class="gf-form">
<span class="gf-form-label width-9">Evaluate every</span>
@@ -186,11 +189,14 @@
<div class="gf-form gf-form--v-stretch">
<span class="gf-form-label width-8">Message</span>
<textarea
class="gf-form-input"
class="gf-form-input gf-form-input--has-help-icon"
rows="10"
ng-model="ctrl.alert.message"
placeholder="Notification message details..."
></textarea>
<info-popover mode="right-absolute">
If you want to apply templating to the alert rule name, you must use the following syntax - ${Label}
</info-popover>
</div>
<div class="gf-form">
<span class="gf-form-label width-8">Tags</span>