Skip to content

Commit

Permalink
Improve groupKey tag based on recommendations from the Pushover devel…
Browse files Browse the repository at this point in the history
…oper

Signed-off-by: Joel Baranick <[email protected]>
  • Loading branch information
kadaan committed Jan 3, 2025
1 parent 7b2743b commit 81efee7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions notify/pushover/pushover.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
priority := tmpl(n.conf.Priority)

var (
alerts = types.Alerts(as...)
groupKey = fmt.Sprintf("groupKey=%s", key.Hash())
u *url.URL
alerts = types.Alerts(as...)
groupKeyTag = fmt.Sprintf("promAlertGroupKey_%s", key.Hash())
u *url.URL
)

title, truncated := notify.TruncateInRunes(tmpl(n.conf.Title), maxTitleLenRunes)
Expand Down Expand Up @@ -157,7 +157,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
parameters.Add("device", tmpl(n.conf.Device))
parameters.Add("sound", tmpl(n.conf.Sound))
if priority == "2" {
parameters.Add("tags", groupKey)
parameters.Add("tags", groupKeyTag)
}
newttl := int64(time.Duration(n.conf.TTL).Seconds())
if newttl > 0 {
Expand All @@ -174,7 +174,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
}
shouldRetry, err := n.sendMessage(ctx, key, u, parameters)
if err == nil && priority == "2" && alerts.Status() == model.AlertResolved {
u, err = url.Parse(fmt.Sprintf("%s/%s.json", n.apiReceiptsURL, groupKey))
u, err = url.Parse(fmt.Sprintf("%s/%s.json", n.apiReceiptsURL, groupKeyTag))
if err != nil {
return false, err
}
Expand Down

0 comments on commit 81efee7

Please sign in to comment.