mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: do not expand template for labels\annotations if value is not a template (#71492)
This commit is contained in:
parent
5099e88227
commit
64aa5465ac
@ -96,6 +96,10 @@ func (e ExpandError) Error() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Expand(ctx context.Context, name, tmpl string, data Data, externalURL *url.URL, evaluatedAt time.Time) (string, error) {
|
func Expand(ctx context.Context, name, tmpl string, data Data, externalURL *url.URL, evaluatedAt time.Time) (string, error) {
|
||||||
|
if !strings.Contains(tmpl, "{{") { // If it is not a template, skip expanding it.
|
||||||
|
return tmpl, nil
|
||||||
|
}
|
||||||
|
|
||||||
// add __alert_ to avoid possible conflicts with other templates
|
// add __alert_ to avoid possible conflicts with other templates
|
||||||
name = "__alert_" + name
|
name = "__alert_" + name
|
||||||
// add variables for the labels and values to the beginning of the template
|
// add variables for the labels and values to the beginning of the template
|
||||||
|
Loading…
Reference in New Issue
Block a user