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
|
@ -190,10 +190,11 @@ func run() int {
|
|||
}
|
||||
|
||||
var (
|
||||
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()
|
||||
alertGCInterval = kingpin.Flag("alerts.gc-interval", "Interval between alert GC.").Default("30m").Duration()
|
||||
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)
|
||||
externalURL = kingpin.Flag("web.external-url", "The URL under which Alertmanager is externally reachable (for example, if Alertmanager is served via a reverse proxy). Used for generating relative and absolute links back to Alertmanager itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Alertmanager. If omitted, relevant URL components will be derived automatically.").String()
|
||||
|
@ -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