Add CLI args for snapshot intervals (#2849)
* Add CLI args for snapshot intervals Signed-off-by: sed-i <82407168+sed-i@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Simon Pasquier <spasquie@redhat.com> Signed-off-by: sed-i <82407168+sed-i@users.noreply.github.com> * use same flag for silences and nflogs intervals Signed-off-by: sed-i <82407168+sed-i@users.noreply.github.com> Co-authored-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
ec2f5f5894
commit
dd63d04a57
|
@ -193,6 +193,7 @@ func run() int {
|
|||
configFile = kingpin.Flag("config.file", "Alertmanager configuration file name.").Default("alertmanager.yml").String()
|
||||
dataDir = kingpin.Flag("storage.path", "Base path for data storage.").Default("data/").String()
|
||||
retention = kingpin.Flag("data.retention", "How long to keep data for.").Default("120h").Duration()
|
||||
maintenanceInterval = kingpin.Flag("data.maintenance-interval", "Interval between garbage collection and snapshotting to disk of the silences and the notification logs.").Default("15m").Duration()
|
||||
alertGCInterval = kingpin.Flag("alerts.gc-interval", "Interval between alert GC.").Default("30m").Duration()
|
||||
|
||||
webConfig = webflag.AddFlags(kingpin.CommandLine)
|
||||
|
@ -273,7 +274,7 @@ func run() int {
|
|||
notificationLogOpts := []nflog.Option{
|
||||
nflog.WithRetention(*retention),
|
||||
nflog.WithSnapshot(filepath.Join(*dataDir, "nflog")),
|
||||
nflog.WithMaintenance(15*time.Minute, stopc, wg.Done, nil),
|
||||
nflog.WithMaintenance(*maintenanceInterval, stopc, wg.Done, nil),
|
||||
nflog.WithMetrics(prometheus.DefaultRegisterer),
|
||||
nflog.WithLogger(log.With(logger, "component", "nflog")),
|
||||
}
|
||||
|
@ -310,7 +311,7 @@ func run() int {
|
|||
// Start providers before router potentially sends updates.
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
silences.Maintenance(15*time.Minute, filepath.Join(*dataDir, "silences"), stopc, nil)
|
||||
silences.Maintenance(*maintenanceInterval, filepath.Join(*dataDir, "silences"), stopc, nil)
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in New Issue