diff --git a/pkg/services/alerting/notifiers/discord.go b/pkg/services/alerting/notifiers/discord.go index 5bbc5039b93..7c8f504ebe6 100644 --- a/pkg/services/alerting/notifiers/discord.go +++ b/pkg/services/alerting/notifiers/discord.go @@ -89,7 +89,9 @@ func (dn *DiscordNotifier) Notify(evalContext *alerting.EvalContext) error { for _, evt := range evalContext.EvalMatches { fields = append(fields, map[string]interface{}{ - "name": evt.Metric, + // Discord uniquely does not send the alert if the metric field is empty, + // which it can be in some cases + "name": notEmpty(evt.Metric), "value": evt.Value.FullString(), "inline": true, }) @@ -213,3 +215,11 @@ func (dn *DiscordNotifier) embedImage(cmd *models.SendWebhookSync, imagePath str return nil } + +func notEmpty(metric string) string { + if metric == "" { + return "" + } + + return metric +}