Rename key to max_runes

Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
This commit is contained in:
Alex Weaver 2022-12-13 17:26:14 -06:00
parent 9b9237cef1
commit 0eee3ca9cb
6 changed files with 9 additions and 9 deletions
notify
opsgenie
pagerduty
pushover
slack
telegram
victorops

View File

@ -176,7 +176,7 @@ func (n *Notifier) createRequests(ctx context.Context, as ...*types.Alert) ([]*h
default:
message, truncated := notify.TruncateInRunes(tmpl(n.conf.Message), maxMessageLenRunes)
if truncated {
level.Warn(n.logger).Log("msg", "Truncated message", "alert", key, "runes", maxMessageLenRunes)
level.Warn(n.logger).Log("msg", "Truncated message", "alert", key, "max_runes", maxMessageLenRunes)
}
createEndpointURL := n.conf.APIURL.Copy()

View File

@ -157,7 +157,7 @@ func (n *Notifier) notifyV1(
description, truncated := notify.TruncateInRunes(tmpl(n.conf.Description), maxV1DescriptionLenRunes)
if truncated {
level.Warn(n.logger).Log("msg", "Truncated description", "key", key, "runes", maxV1DescriptionLenRunes)
level.Warn(n.logger).Log("msg", "Truncated description", "key", key, "max_runes", maxV1DescriptionLenRunes)
}
serviceKey := string(n.conf.ServiceKey)
@ -222,7 +222,7 @@ func (n *Notifier) notifyV2(
summary, truncated := notify.TruncateInRunes(tmpl(n.conf.Description), maxV2SummaryLenRunes)
if truncated {
level.Warn(n.logger).Log("msg", "Truncated summary", "key", key, "runes", maxV2SummaryLenRunes)
level.Warn(n.logger).Log("msg", "Truncated summary", "key", key, "max_runes", maxV2SummaryLenRunes)
}
routingKey := string(n.conf.RoutingKey)

View File

@ -89,7 +89,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
title, truncated := notify.TruncateInRunes(tmpl(n.conf.Title), maxTitleLenRunes)
if truncated {
level.Warn(n.logger).Log("msg", "Truncated title", "incident", key, "runes", maxTitleLenRunes)
level.Warn(n.logger).Log("msg", "Truncated title", "incident", key, "max_runes", maxTitleLenRunes)
}
parameters.Add("title", title)
@ -102,7 +102,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
message, truncated = notify.TruncateInRunes(message, maxMessageLenRunes)
if truncated {
level.Warn(n.logger).Log("msg", "Truncated message", "incident", key, "runes", maxMessageLenRunes)
level.Warn(n.logger).Log("msg", "Truncated message", "incident", key, "max_runes", maxMessageLenRunes)
}
message = strings.TrimSpace(message)
if message == "" {
@ -113,7 +113,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
supplementaryURL, truncated := notify.TruncateInRunes(tmpl(n.conf.URL), maxURLLenRunes)
if truncated {
level.Warn(n.logger).Log("msg", "Truncated URL", "incident", key, "runes", maxURLLenRunes)
level.Warn(n.logger).Log("msg", "Truncated URL", "incident", key, "max_runes", maxURLLenRunes)
}
parameters.Add("url", supplementaryURL)
parameters.Add("url_title", tmpl(n.conf.URLTitle))

View File

@ -109,7 +109,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
if err != nil {
return false, err
}
level.Warn(n.logger).Log("msg", "Truncated title", "key", key, "runes", maxTitleLenRunes)
level.Warn(n.logger).Log("msg", "Truncated title", "key", key, "max_runes", maxTitleLenRunes)
}
att := &attachment{
Title: title,

View File

@ -76,7 +76,7 @@ func (n *Notifier) Notify(ctx context.Context, alert ...*types.Alert) (bool, err
messageText, truncated := notify.TruncateInRunes(tmpl(n.conf.Message), maxMessageLenRunes)
if truncated {
level.Warn(n.logger).Log("msg", "Truncated message", "alert", key, "runes", maxMessageLenRunes)
level.Warn(n.logger).Log("msg", "Truncated message", "alert", key, "max_runes", maxMessageLenRunes)
}
message, err := n.client.Send(telebot.ChatID(n.conf.ChatID), messageText, &telebot.SendOptions{

View File

@ -139,7 +139,7 @@ func (n *Notifier) createVictorOpsPayload(ctx context.Context, as ...*types.Aler
stateMessage, truncated := notify.TruncateInRunes(stateMessage, maxMessageLenRunes)
if truncated {
level.Warn(n.logger).Log("msg", "Truncated state_message", "incident", key, "runes", maxMessageLenRunes)
level.Warn(n.logger).Log("msg", "Truncated state_message", "incident", key, "max_runes", maxMessageLenRunes)
}
msg := map[string]string{