grafana / grafana/alerting

Slack mentions should check length of the rendered template instead of the template source

Open
#129 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.