From a483044557658ccd47f9b1d7336e4fec0c24de54 Mon Sep 17 00:00:00 2001 From: assassins Date: Thu, 29 Jul 2021 00:26:20 +0800 Subject: [PATCH] Performance optimization (#1481) There are redundant steps --- app/vmalert/notifier/alert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vmalert/notifier/alert.go b/app/vmalert/notifier/alert.go index fe1223f38c..991ef1db3d 100644 --- a/app/vmalert/notifier/alert.go +++ b/app/vmalert/notifier/alert.go @@ -90,13 +90,13 @@ func templateAnnotations(annotations map[string]string, data AlertTplData, funcs eg := new(utils.ErrGroup) r := make(map[string]string, len(annotations)) for key, text := range annotations { - r[key] = text buf.Reset() builder.Reset() builder.Grow(len(tplHeader) + len(text)) builder.WriteString(tplHeader) builder.WriteString(text) if err := templateAnnotation(&buf, builder.String(), data, funcs); err != nil { + r[key] = text eg.Add(fmt.Errorf("key %q, template %q: %w", key, text, err)) continue }