Skip to content

Commit

Permalink
Allow setting TSDB block duration
Browse files Browse the repository at this point in the history
  • Loading branch information
fhalim committed Sep 5, 2019
1 parent 733e9fa commit e3faabe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/thanos/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func registerReceive(m map[string]setupFunc, app *kingpin.Application, name stri

replicationFactor := cmd.Flag("receive.replication-factor", "How many times to replicate incoming write requests.").Default("1").Uint64()

tsdbBlockDuration := modelDuration(cmd.Flag("tsdb.blockduration", "Duration for local TSDB blocks").Default("2h"))

m[name] = func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ bool) error {
lset, err := parseFlagLabels(*labelStrs)
if err != nil {
Expand Down Expand Up @@ -106,6 +108,7 @@ func registerReceive(m map[string]setupFunc, app *kingpin.Application, name stri
*tenantHeader,
*replicaHeader,
*replicationFactor,
*tsdbBlockDuration,
)
}
}
Expand All @@ -130,15 +133,16 @@ func runReceive(
tenantHeader string,
replicaHeader string,
replicationFactor uint64,
tsdbBlockDuration model.Duration,
) error {
logger = log.With(logger, "component", "receive")
level.Warn(logger).Log("msg", "setting up receive; the Thanos receive component is EXPERIMENTAL, it may break significantly without notice")

tsdbCfg := &tsdb.Options{
RetentionDuration: retention,
NoLockfile: true,
MinBlockDuration: model.Duration(time.Hour * 2),
MaxBlockDuration: model.Duration(time.Hour * 2),
MinBlockDuration: tsdbBlockDuration,
MaxBlockDuration: tsdbBlockDuration,
}

localStorage := &tsdb.ReadyStorage{}
Expand Down

0 comments on commit e3faabe

Please sign in to comment.