From b38c6cd1e69a443ce6cdf5e91de672eac6013216 Mon Sep 17 00:00:00 2001 From: "Schlotter, Christian" Date: Wed, 10 Jun 2020 18:03:14 +0200 Subject: [PATCH] compact: introduce flag --block-viewer.global.sync-block-interval Thanos compact currently does metadata sync every minute if `--wait` is active. Thanos store has a equivalent flag named `sync-block-duration`. This commit introduces `--block-viewer.global.sync-block-interval` to be able to configure the interval via a flag. Signed-off-by: Schlotter, Christian --- CHANGELOG.md | 1 + cmd/thanos/compact.go | 5 ++++- docs/components/compact.md | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5035a7a56a..8633d503d90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel - [#2671](https://github.com/thanos-io/thanos/pull/2671) Tools: bucket replicate now allows passing repeated `--compaction` and `--resolution` flags. - [#2657](https://github.com/thanos-io/thanos/pull/2657) Querier: Now, has the ability to perform concurrent select request per query. +- [#2752](https://github.com/thanos-io/thanos/pull/2752) Compact: add flag to configure metadata sync interval for the bucket ui ## [v0.13.0](https://github.com/thanos-io/thanos/releases) - IN PROGRESS diff --git a/cmd/thanos/compact.go b/cmd/thanos/compact.go index 2818b339f26..6794f4f7d54 100644 --- a/cmd/thanos/compact.go +++ b/cmd/thanos/compact.go @@ -400,7 +400,7 @@ func runCompact( iterCancel() // For /global state make sure to fetch periodically. - return runutil.Repeat(time.Minute, ctx.Done(), func() error { + return runutil.Repeat(conf.blockViewerSyncBlockInterval, ctx.Done(), func() error { return runutil.RetryWithLog(logger, time.Minute, ctx.Done(), func() error { iterCtx, iterCancel := context.WithTimeout(ctx, conf.waitInterval) defer iterCancel() @@ -435,6 +435,7 @@ type compactConfig struct { waitInterval time.Duration disableDownsampling bool blockSyncConcurrency int + blockViewerSyncBlockInterval time.Duration compactionConcurrency int deleteDelay model.Duration dedupReplicaLabels []string @@ -482,6 +483,8 @@ func (cc *compactConfig) registerFlag(cmd *kingpin.CmdClause) *compactConfig { cmd.Flag("block-sync-concurrency", "Number of goroutines to use when syncing block metadata from object storage."). Default("20").IntVar(&cc.blockSyncConcurrency) + cmd.Flag("block-viewer.global.sync-block-interval", "Repeat interval for syncing the blocks between local and remote view for /global Block Viewer UI."). + Default("1m").DurationVar(&cc.blockViewerSyncBlockInterval) cmd.Flag("compact.concurrency", "Number of goroutines to use when compacting groups."). Default("1").IntVar(&cc.compactionConcurrency) diff --git a/docs/components/compact.md b/docs/components/compact.md index 1ca48e14a8a..0bb61b86384 100644 --- a/docs/components/compact.md +++ b/docs/components/compact.md @@ -141,6 +141,10 @@ Flags: --block-sync-concurrency=20 Number of goroutines to use when syncing block metadata from object storage. + --block-viewer.global.sync-block-interval=1m + Repeat interval for syncing the blocks between + local and remote view for /global Block Viewer + UI. --compact.concurrency=1 Number of goroutines to use when compacting groups. --delete-delay=48h Time before a block marked for deletion is