fix: alertmanager template slice bounds out of range
What
Stop using the title
function.
Why
In gitlab-com/gl-infra/production#8331 (comment 1259084455) we see a few alerts failing to be notified because the template is failing with the following errors:
"firing": failed to template "{{ template \"slack.text\" . }}": template: gitlab.tmpl:37:49: executing "gitlab.text" at <title>: error calling title: runtime error: slice bounds out of range [6:4]
template: gitlab.tmpl:37:49: executing "gitlab.text" at <title>: error calling title: runtime error: slice bounds out of range [1:0]
gitlab.tmpl:3:48: executing "gitlab.title" at <title>: error calling title: runtime error: slice bounds out of range [9:8]
All these errors seem to be coming from the title
function, which uses
strings.Title
behind the scenes,
which might be causing the problem.
Removing the use of title
will help us confirm that it's the
title
function causing the error so we can report this upstream.