mirror of
https://github.com/prometheus/alertmanager
synced 2025-01-27 16:43:41 +00:00
Simplify notify provider interface
This commit is contained in:
parent
5afb402a6c
commit
77cce75c05
@ -163,7 +163,7 @@ func (n *DedupingNotifier) Notify(ctx context.Context, alerts ...*types.Alert) e
|
||||
return err
|
||||
}
|
||||
|
||||
return n.notifies.Set(name, newNotifies...)
|
||||
return n.notifies.Set(newNotifies...)
|
||||
}
|
||||
|
||||
// RoutedNotifier dispatches the alerts to one of a set of
|
||||
|
@ -204,7 +204,7 @@ func NewMemNotifies(data *MemData) *MemNotifies {
|
||||
return &MemNotifies{data: data}
|
||||
}
|
||||
|
||||
func (n *MemNotifies) Set(dest string, ns ...*types.Notify) error {
|
||||
func (n *MemNotifies) Set(ns ...*types.Notify) error {
|
||||
n.data.mtx.Lock()
|
||||
defer n.data.mtx.Unlock()
|
||||
|
||||
@ -212,10 +212,10 @@ func (n *MemNotifies) Set(dest string, ns ...*types.Notify) error {
|
||||
if notify == nil {
|
||||
continue
|
||||
}
|
||||
am, ok := n.data.notifies[dest]
|
||||
am, ok := n.data.notifies[notify.SendTo]
|
||||
if !ok {
|
||||
am = map[model.Fingerprint]*types.Notify{}
|
||||
n.data.notifies[dest] = am
|
||||
n.data.notifies[notify.SendTo] = am
|
||||
}
|
||||
am[notify.Alert] = notify
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ type Silences interface {
|
||||
type Notifies interface {
|
||||
Get(dest string, fps ...model.Fingerprint) ([]*types.Notify, error)
|
||||
// Set several notifies at once. All or none must succeed.
|
||||
Set(dest string, ns ...*types.Notify) error
|
||||
Set(ns ...*types.Notify) error
|
||||
}
|
||||
|
||||
type Config interface {
|
||||
|
Loading…
Reference in New Issue
Block a user