@@ -192,20 +192,25 @@ func New(cfg *Config, reg *prometheus.Registry) (*Alertmanager, error) {
192
192
193
193
am .wg .Add (1 )
194
194
var err error
195
- am .nflog , err = nflog .New (
196
- nflog .WithRetention (cfg .Retention ),
197
- nflog .WithSnapshot (filepath .Join (cfg .TenantDataDir , notificationLogSnapshot )),
198
- nflog .WithMaintenance (maintenancePeriod , am .stop , am .wg .Done , nil ),
199
- nflog .WithMetrics (am .registry ),
200
- nflog .WithLogger (log .With (am .logger , "component" , "nflog" )),
201
- )
195
+
196
+ am .nflog , err = nflog .New (nflog.Options {
197
+ SnapshotFile : filepath .Join (cfg .TenantDataDir , notificationLogSnapshot ),
198
+ Retention : cfg .Retention ,
199
+ Logger : log .With (am .logger , "component" , "nflog" ),
200
+ Metrics : am .registry ,
201
+ })
202
+
202
203
if err != nil {
203
204
return nil , fmt .Errorf ("failed to create notification log: %v" , err )
204
205
}
205
206
206
207
c := am .state .AddState ("nfl:" + cfg .UserID , am .nflog , am .registry )
207
208
am .nflog .SetBroadcast (c .Broadcast )
208
-
209
+ am .wg .Add (1 )
210
+ go func () {
211
+ am .nflog .Maintenance (maintenancePeriod , filepath .Join (cfg .TenantDataDir , notificationLogSnapshot ), am .stop , nil )
212
+ am .wg .Done ()
213
+ }()
209
214
am .marker = types .NewMarker (am .registry )
210
215
211
216
silencesFile := filepath .Join (cfg .TenantDataDir , silencesSnapshot )
@@ -320,7 +325,7 @@ func (am *Alertmanager) ApplyConfig(userID string, conf *config.Config, rawCfg s
320
325
templateFiles [i ] = templateFilepath
321
326
}
322
327
323
- tmpl , err := template .FromGlobs (templateFiles ... )
328
+ tmpl , err := template .FromGlobs (templateFiles )
324
329
if err != nil {
325
330
return err
326
331
}
@@ -461,7 +466,7 @@ func (am *Alertmanager) getFullState() (*clusterpb.FullState, error) {
461
466
462
467
// buildIntegrationsMap builds a map of name to the list of integration notifiers off of a
463
468
// list of receiver config.
464
- func buildIntegrationsMap (nc []* config.Receiver , tmpl * template.Template , firewallDialer * util_net.FirewallDialer , logger log.Logger , notifierWrapper func (string , notify.Notifier ) notify.Notifier ) (map [string ][]notify.Integration , error ) {
469
+ func buildIntegrationsMap (nc []config.Receiver , tmpl * template.Template , firewallDialer * util_net.FirewallDialer , logger log.Logger , notifierWrapper func (string , notify.Notifier ) notify.Notifier ) (map [string ][]notify.Integration , error ) {
465
470
integrationsMap := make (map [string ][]notify.Integration , len (nc ))
466
471
for _ , rcv := range nc {
467
472
integrations , err := buildReceiverIntegrations (rcv , tmpl , firewallDialer , logger , notifierWrapper )
@@ -476,7 +481,7 @@ func buildIntegrationsMap(nc []*config.Receiver, tmpl *template.Template, firewa
476
481
// buildReceiverIntegrations builds a list of integration notifiers off of a
477
482
// receiver config.
478
483
// Taken from https://github.com/prometheus/alertmanager/blob/94d875f1227b29abece661db1a68c001122d1da5/cmd/alertmanager/main.go#L112-L159.
479
- func buildReceiverIntegrations (nc * config.Receiver , tmpl * template.Template , firewallDialer * util_net.FirewallDialer , logger log.Logger , wrapper func (string , notify.Notifier ) notify.Notifier ) ([]notify.Integration , error ) {
484
+ func buildReceiverIntegrations (nc config.Receiver , tmpl * template.Template , firewallDialer * util_net.FirewallDialer , logger log.Logger , wrapper func (string , notify.Notifier ) notify.Notifier ) ([]notify.Integration , error ) {
480
485
var (
481
486
errs types.MultiError
482
487
integrations []notify.Integration
0 commit comments