-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncating fields that are sent to slack #2774
Conversation
9106aa7
to
b83a629
Compare
Thanks for your contribution. I think we should limit the length of the fields we send to slack, like we do for pagerduty (IIRC), instead of limiting the number of alerts. |
b83a629
to
733759b
Compare
Removed the max alerts config parameter and truncated the field that is the longest as per https://github.com/prometheus/alertmanager/blob/main/template/default.tmpl#L15 |
notify/slack/slack.go
Outdated
key, err := notify.ExtractGroupKey(ctx) | ||
|
||
if err != nil { | ||
return false, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would move this block inside the if truncated { ... }
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
733759b
to
4079c29
Compare
notify/slack/slack.go
Outdated
if err != nil { | ||
return false, err | ||
} | ||
level.Debug(n.logger).Log("msg", "Truncated text", "text", title, "key", key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
level.Debug(n.logger).Log("msg", "Truncated text", "text", title, "key", key) | |
level.Debug(n.logger).Log("msg", "Truncated title", "text", title, "key", key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
correcting the logic to trucate fields instead of dropping alerts in the slack integration Signed-off-by: Prashant Balachandran <[email protected]>
4079c29
to
a79a4ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. Thanks!
Signed-off-by: Prashant Balachandran [email protected]
Fixed issue #2769