Notification character limit

In Slack, if the message is too long, it will truncate the message. If Grafana sends a notification that is longer that the Grafana message character limit, the notification is truncated, which breaks the templating visualization. It will show as many alerts as possible. The unfortunate alert that is truncated will show partial formatting, and then raw text with formatting markup that was not parsed correctly because the ending markup was lost in the truncation.

Is there a way to limit how many characters are added to a notification?

If not, this could possibly be a bug, or a feature request.

One way to possibly hack the situation would be to create a counter loop in the template and only allow so many alerts to be printed by the template… :thinking:

I could also try adding some extra groupings, which would only work if the alerts are similar, if I recall correctly…

1 Like

Truncation is OK, because you will get at least some notification.
But MS Team rejects message completely, so you can be on fire with many alerts, but your MS Team will be quiet :shushing_face:

I would limit number of processed alerts in the template, e. g. first 5 and if len(alerts) >5 then just append “and others…” at the end.
BTW: I don’t believe that someone will read full message if there is many alerts anyway, so it is better from the user perspective.

@jangaraj, true, at least the notification still sends. Truncation is certainly better than nothing.

Also true, nobody will read through all the alerts in a message.

Yes, a limit is the template is probably the best way to go at this point.

Thanks for the feedback.