Alerting: Small readability improvements to template.go (#63422)

* Alerting: Small readability improvements to template.go

* Fix lint
This commit is contained in:
George Robinson
2023-02-20 09:24:11 +00:00
committed by GitHub
parent c30f3a617b
commit 0a01391ebe
3 changed files with 43 additions and 41 deletions

View File

@@ -142,7 +142,7 @@ func (rs *ruleStates) expandRuleLabelsAndAnnotations(ctx context.Context, log lo
expand := func(original map[string]string) map[string]string {
expanded := make(map[string]string, len(original))
for k, v := range original {
ev, err := template.Expand(ctx, alertRule.Title, v, templateLabels, alertInstance, externalURL)
ev, err := template.Expand(ctx, alertRule.Title, v, template.NewData(templateLabels, alertInstance), externalURL, alertInstance.EvaluatedAt)
expanded[k] = ev
if err != nil {
log.Error("Error in expanding template", "name", k, "value", v, "error", err)