From 1011c4b2b94f0fe64ff1d4bbc61dabb335476d81 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 848b14ab98..0e97093b90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,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. - [#2754](https://github.com/thanos-io/thanos/pull/2671) UI: add stores page in the React UI. +- [#2752](https://github.com/thanos-io/thanos/pull/2752) Compact: add flag `--block-viewer.global.sync-block-interval` to configure metadata sync interval for the bucket UI. ## [v0.13.0](https://github.com/thanos-io/thanos/releases/tag/v0.13.0) - 2020.06.22 diff --git a/cmd/thanos/compact.go b/cmd/thanos/compact.go index 2818b339f2..6794f4f7d5 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 99f5e6a30c..ee924bfdec 100644 --- a/docs/components/compact.md +++ b/docs/components/compact.md @@ -143,6 +143,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