Skip to content

Commit db70e42

Browse files
committed
Add summary in content
1 parent 093b67f commit db70e42

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ type alertManOut struct {
4949
}
5050

5151
type discordOut struct {
52-
Embeds []discordEmbed `json:"embeds"`
52+
Content string `json:"content"`
53+
Embeds []discordEmbed `json:"embeds"`
5354
}
5455

5556
type discordEmbed struct {
@@ -97,7 +98,7 @@ func main() {
9798
DO := discordOut{}
9899

99100
RichEmbed := discordEmbed{
100-
Title: amo.CommonLabels.Alertname,
101+
Title: fmt.Sprintf("[%s:%d] %s", strings.ToUpper(status), len(alerts), amo.CommonLabels.Alertname),
101102
Description: amo.CommonAnnotations.Summary,
102103
Color: ColorGrey,
103104
Fields: []discordEmbedField{},
@@ -109,6 +110,10 @@ func main() {
109110
RichEmbed.Color = ColorGreen
110111
}
111112

113+
if amo.CommonAnnotations.Summary != "" {
114+
DO.Content = fmt.Sprintf(" === %s === \n", amo.CommonAnnotations.Summary)
115+
}
116+
112117
for _, alert := range alerts {
113118
realname := alert.Labels["instance"]
114119
if strings.Contains(realname, "localhost") && alert.Labels["exported_instance"] != "" {

0 commit comments

Comments
 (0)