Simplify notify provider interface

This commit is contained in:
Fabian Reinartz 2015-10-06 20:40:52 +02:00
parent 5afb402a6c
commit 77cce75c05
3 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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 {