Slack mentions should check length of the rendered template instead of the template source
Open
bug
- Dominant language
- Go
- Stars
- 89
- Forks
- 74
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 8
Description
The slack user and group mentions should check the length of the rendered go template when deciding whether or not to add a mention to the slack pretext. Currently, the logic checks the length of the source string for it's conditional logic, and renders the template when interpolating it into the slack pretext.
This is a problem, because if the go template renders into an empty string, a broken mention will be added to the pretext.
To reproduce, use `{{- /* empty */ -}}` as the "Mention Groups" configuration setting.
https://github.com/grafana/alerting/blob/939f55779e5ff663b9f557a34e73191625ac1d85/receivers/slack/slack.go#L368-L380
Contributor guide
Assessment
This issue has not been assessed yet.