Skip to content

Commit

Permalink
produce warn message if non 2h block time
Browse files Browse the repository at this point in the history
  • Loading branch information
yeya24 committed Apr 17, 2019
1 parent 79d50a1 commit 2960787
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/thanos/sidecar.go
Expand Up @@ -336,10 +336,16 @@ func validatePrometheus(ctx context.Context, logger log.Logger, m *promMetadata)
if err != nil {
return errors.Wrap(err, "failed to check flags")
}
// Check if min-block-time and max-block-time are 2h.
if flags.TSDBMinTime != model.Duration(2*time.Hour) || flags.TSDBMaxTime != model.Duration(2*time.Hour) {

// Check if compaction is disabled.
if flags.TSDBMinTime != flags.TSDBMaxTime {
return errors.Errorf("Found that TSDB Max time is %s and Min time is %s. "+
"Compaction needs to be disabled (storage.tsdb.min-block-duration = storage.tsdb.max-block-duration = 2h)", flags.TSDBMaxTime, flags.TSDBMinTime)
"Compaction needs to be disabled (storage.tsdb.min-block-duration = storage.tsdb.max-block-duration)", flags.TSDBMaxTime, flags.TSDBMinTime)
}

// Check if block time is 2h.
if flags.TSDBMinTime != model.Duration(2*time.Hour) {
level.Warn(logger).Log("msg", "Found that TSDB block time is not 2h. Only 2h block time is recommended.", "block-time", flags.TSDBMinTime)
}

return nil
Expand Down

0 comments on commit 2960787

Please sign in to comment.