Skip to content

Commit

Permalink
Add CLI args for snapshot intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
sed-i committed Mar 15, 2022
1 parent ec2f5f5 commit e7e6031
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/alertmanager/main.go
Expand Up @@ -195,6 +195,9 @@ func run() int {
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()

silencesInterval = kingpin.Flag("silences.interval", "Interval between writing silences snapshot to disk.").Default("15m").Duration()
nflogsInterval = kingpin.Flag("nflogs.interval", "Interval between writing nflogs snapshot to disk.").Default("15m").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()
routePrefix = kingpin.Flag("web.route-prefix", "Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url.").String()
Expand Down Expand Up @@ -273,7 +276,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(*nflogsInterval, stopc, wg.Done, nil),
nflog.WithMetrics(prometheus.DefaultRegisterer),
nflog.WithLogger(log.With(logger, "component", "nflog")),
}
Expand Down Expand Up @@ -310,7 +313,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(*silencesInterval, filepath.Join(*dataDir, "silences"), stopc, nil)
wg.Done()
}()

Expand Down

0 comments on commit e7e6031

Please sign in to comment.