Skip to content

Commit

Permalink
receive: Make max backoff configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
philipgough committed Feb 23, 2023
1 parent 1967cd0 commit cfabc98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/thanos/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func runReceive(
TLSConfig: rwTLSConfig,
DialOpts: dialOpts,
ForwardTimeout: time.Duration(*conf.forwardTimeout),
MaxBackoff: time.Duration(*conf.maxBackoff),
TSDBStats: dbs,
Limiter: limiter,
})
Expand Down Expand Up @@ -775,6 +776,7 @@ type receiveConfig struct {
replicaHeader string
replicationFactor uint64
forwardTimeout *model.Duration
maxBackoff *model.Duration
compression string

tsdbMinBlockDuration *model.Duration
Expand Down Expand Up @@ -865,6 +867,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())
Expand Down
3 changes: 2 additions & 1 deletion pkg/receive/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit cfabc98

Please sign in to comment.