From d053dc54b31673a7f877da9b7e92c66bfe952c62 Mon Sep 17 00:00:00 2001 From: Philip Gough Date: Thu, 23 Feb 2023 13:07:15 +0000 Subject: [PATCH] receive: Make max backoff configurable Signed-off-by: Philip Gough --- CHANGELOG.md | 1 + cmd/thanos/receive.go | 4 ++++ pkg/receive/handler.go | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d988ce34b3..15c062718e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#6185](https://github.com/thanos-io/thanos/pull/6185) Tracing: tracing in OTLP support configuring service_name. - [#6192](https://github.com/thanos-io/thanos/pull/6192) Store: add flag `bucket-web-label` to select the label to use as timeline title in web UI +- [#6163](https://github.com/thanos-io/thanos/pull/6163) Receiver: Add hidden flag `--receive-forward-max-backoff` to configure the max backoff for forwarding requests. ### Fixed diff --git a/cmd/thanos/receive.go b/cmd/thanos/receive.go index 4e5093a997a..92a7adf145a 100644 --- a/cmd/thanos/receive.go +++ b/cmd/thanos/receive.go @@ -243,6 +243,7 @@ func runReceive( TLSConfig: rwTLSConfig, DialOpts: dialOpts, ForwardTimeout: time.Duration(*conf.forwardTimeout), + MaxBackoff: time.Duration(*conf.maxBackoff), TSDBStats: dbs, Limiter: limiter, }) @@ -778,6 +779,7 @@ type receiveConfig struct { replicaHeader string replicationFactor uint64 forwardTimeout *model.Duration + maxBackoff *model.Duration compression string tsdbMinBlockDuration *model.Duration @@ -868,6 +870,8 @@ func (rc *receiveConfig) registerFlag(cmd extkingpin.FlagClause) { rc.forwardTimeout = extkingpin.ModelDuration(cmd.Flag("receive-forward-timeout", "Timeout for each forward request.").Default("5s").Hidden()) + rc.maxBackoff = extkingpin.ModelDuration(cmd.Flag("receive-forward-max-backoff", "Maximum backoff for each forward fan-out request").Default("30s").Hidden()) + rc.relabelConfigPath = extflag.RegisterPathOrContent(cmd, "receive.relabel-config", "YAML file that contains relabeling configuration.", extflag.WithEnvSubstitution()) rc.tsdbMinBlockDuration = extkingpin.ModelDuration(cmd.Flag("tsdb.min-block-duration", "Min duration for local TSDB blocks").Default("2h").Hidden()) diff --git a/pkg/receive/handler.go b/pkg/receive/handler.go index d006aad2d3c..3cce0552ab8 100644 --- a/pkg/receive/handler.go +++ b/pkg/receive/handler.go @@ -98,6 +98,7 @@ type Options struct { TLSConfig *tls.Config DialOpts []grpc.DialOption ForwardTimeout time.Duration + MaxBackoff time.Duration RelabelConfigs []*relabel.Config TSDBStats TSDBStats Limiter *Limiter @@ -148,7 +149,7 @@ func NewHandler(logger log.Logger, o *Options) *Handler { expBackoff: backoff.Backoff{ Factor: 2, Min: 100 * time.Millisecond, - Max: 30 * time.Second, + Max: o.MaxBackoff, Jitter: true, }, Limiter: o.Limiter,