mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Remove error return value from NotifyFunc() (#4459)
It's always nil and we also forgot to check it. Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
0c54cf489b
commit
90521a65f8
|
@ -682,7 +682,7 @@ func computeExternalURL(u, listenAddr string) (*url.URL, error) {
|
||||||
// sendAlerts implements the rules.NotifyFunc for a Notifier.
|
// sendAlerts implements the rules.NotifyFunc for a Notifier.
|
||||||
// It filters any non-firing alerts from the input.
|
// It filters any non-firing alerts from the input.
|
||||||
func sendAlerts(n *notifier.Manager, externalURL string) rules.NotifyFunc {
|
func sendAlerts(n *notifier.Manager, externalURL string) rules.NotifyFunc {
|
||||||
return func(ctx context.Context, expr string, alerts ...*rules.Alert) error {
|
return func(ctx context.Context, expr string, alerts ...*rules.Alert) {
|
||||||
var res []*notifier.Alert
|
var res []*notifier.Alert
|
||||||
|
|
||||||
for _, alert := range alerts {
|
for _, alert := range alerts {
|
||||||
|
@ -705,6 +705,5 @@ func sendAlerts(n *notifier.Manager, externalURL string) rules.NotifyFunc {
|
||||||
if len(alerts) > 0 {
|
if len(alerts) > 0 {
|
||||||
n.Send(res...)
|
n.Send(res...)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,7 +573,7 @@ type Appendable interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NotifyFunc sends notifications about a set of alerts generated by the given expression.
|
// NotifyFunc sends notifications about a set of alerts generated by the given expression.
|
||||||
type NotifyFunc func(ctx context.Context, expr string, alerts ...*Alert) error
|
type NotifyFunc func(ctx context.Context, expr string, alerts ...*Alert)
|
||||||
|
|
||||||
// ManagerOptions bundles options for the Manager.
|
// ManagerOptions bundles options for the Manager.
|
||||||
type ManagerOptions struct {
|
type ManagerOptions struct {
|
||||||
|
|
|
@ -348,9 +348,7 @@ func TestForStateRestore(t *testing.T) {
|
||||||
TSDB: suite.Storage(),
|
TSDB: suite.Storage(),
|
||||||
Context: context.Background(),
|
Context: context.Background(),
|
||||||
Logger: log.NewNopLogger(),
|
Logger: log.NewNopLogger(),
|
||||||
NotifyFunc: func(ctx context.Context, expr string, alerts ...*Alert) error {
|
NotifyFunc: func(ctx context.Context, expr string, alerts ...*Alert) {},
|
||||||
return nil
|
|
||||||
},
|
|
||||||
OutageTolerance: 30 * time.Minute,
|
OutageTolerance: 30 * time.Minute,
|
||||||
ForGracePeriod: 10 * time.Minute,
|
ForGracePeriod: 10 * time.Minute,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue