@@ -192,20 +192,20 @@ func New(cfg *Config, reg *prometheus.Registry) (*Alertmanager, error) {
192
192
193
193
am .wg .Add (1 )
194
194
var err error
195
+
195
196
am .nflog , err = nflog .New (
196
197
nflog .WithRetention (cfg .Retention ),
197
198
nflog .WithSnapshot (filepath .Join (cfg .TenantDataDir , notificationLogSnapshot )),
198
199
nflog .WithMaintenance (maintenancePeriod , am .stop , am .wg .Done , nil ),
199
200
nflog .WithMetrics (am .registry ),
200
201
nflog .WithLogger (log .With (am .logger , "component" , "nflog" )),
201
202
)
203
+
202
204
if err != nil {
203
205
return nil , fmt .Errorf ("failed to create notification log: %v" , err )
204
206
}
205
-
206
207
c := am .state .AddState ("nfl:" + cfg .UserID , am .nflog , am .registry )
207
208
am .nflog .SetBroadcast (c .Broadcast )
208
-
209
209
am .marker = types .NewMarker (am .registry )
210
210
211
211
silencesFile := filepath .Join (cfg .TenantDataDir , silencesSnapshot )
@@ -218,10 +218,8 @@ func New(cfg *Config, reg *prometheus.Registry) (*Alertmanager, error) {
218
218
if err != nil {
219
219
return nil , fmt .Errorf ("failed to create silences: %v" , err )
220
220
}
221
-
222
221
c = am .state .AddState ("sil:" + cfg .UserID , am .silences , am .registry )
223
222
am .silences .SetBroadcast (c .Broadcast )
224
-
225
223
// State replication needs to be started after the state keys are defined.
226
224
if service , ok := am .state .(services.Service ); ok {
227
225
if err := service .StartAsync (context .Background ()); err != nil {
@@ -320,7 +318,7 @@ func (am *Alertmanager) ApplyConfig(userID string, conf *config.Config, rawCfg s
320
318
templateFiles [i ] = templateFilepath
321
319
}
322
320
323
- tmpl , err := template .FromGlobs (templateFiles ... )
321
+ tmpl , err := template .FromGlobs (templateFiles )
324
322
if err != nil {
325
323
return err
326
324
}
@@ -461,7 +459,7 @@ func (am *Alertmanager) getFullState() (*clusterpb.FullState, error) {
461
459
462
460
// buildIntegrationsMap builds a map of name to the list of integration notifiers off of a
463
461
// 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 ) {
462
+ 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
463
integrationsMap := make (map [string ][]notify.Integration , len (nc ))
466
464
for _ , rcv := range nc {
467
465
integrations , err := buildReceiverIntegrations (rcv , tmpl , firewallDialer , logger , notifierWrapper )
@@ -476,7 +474,7 @@ func buildIntegrationsMap(nc []*config.Receiver, tmpl *template.Template, firewa
476
474
// buildReceiverIntegrations builds a list of integration notifiers off of a
477
475
// receiver config.
478
476
// 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 ) {
477
+ 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
478
var (
481
479
errs types.MultiError
482
480
integrations []notify.Integration
0 commit comments