mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Add feature to clean up data in Consul
Running the app with `-app.pipe.cleanup-only` will delete any records from Consul that are marked as deleted more than ten minutes ago, then exit. This is so you can set it to run as a cronjob, e.g. once an hour.
This commit is contained in:
@@ -267,6 +267,12 @@ func appMain(flags appFlags) {
|
||||
log.Fatalf("Error creating pipe router: %v", err)
|
||||
return
|
||||
}
|
||||
if flags.cleanupPipesOnly {
|
||||
pipeRouter.CleanUp()
|
||||
return
|
||||
}
|
||||
|
||||
pipeRouter.Start()
|
||||
|
||||
// Start background version checking
|
||||
checkpoint.CheckInterval(&checkpoint.CheckParams{
|
||||
|
||||
@@ -168,6 +168,7 @@ type appFlags struct {
|
||||
controlRouterURL string
|
||||
controlRPCTimeout time.Duration
|
||||
pipeRouterURL string
|
||||
cleanupPipesOnly bool
|
||||
natsHostname string
|
||||
memcachedHostname string
|
||||
memcachedTimeout time.Duration
|
||||
@@ -381,6 +382,7 @@ func setupFlags(flags *flags) {
|
||||
flag.StringVar(&flags.app.controlRouterURL, "app.control.router", "local", "Control router to use (local or sqs)")
|
||||
flag.DurationVar(&flags.app.controlRPCTimeout, "app.control.rpctimeout", time.Minute, "Timeout for control RPC")
|
||||
flag.StringVar(&flags.app.pipeRouterURL, "app.pipe.router", "local", "Pipe router to use (local)")
|
||||
flag.BoolVar(&flags.app.cleanupPipesOnly, "app.pipe.cleanup-only", false, "Clean up deleted pipes and exit")
|
||||
flag.StringVar(&flags.app.natsHostname, "app.nats", "", "Hostname for NATS service to use for shortcut reports. If empty, shortcut reporting will be disabled.")
|
||||
flag.StringVar(&flags.app.memcachedHostname, "app.memcached.hostname", "", "Hostname for memcached service to use when caching reports. If empty, no memcached will be used.")
|
||||
flag.DurationVar(&flags.app.memcachedTimeout, "app.memcached.timeout", 100*time.Millisecond, "Maximum time to wait before giving up on memcached requests.")
|
||||
|
||||
Reference in New Issue
Block a user