Skip to content

Commit

Permalink
update msg and remove experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
yeya24 committed Mar 30, 2019
1 parent f7257e1 commit 8e9499b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
15 changes: 6 additions & 9 deletions cmd/thanos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func registerSidecar(m map[string]setupFunc, app *kingpin.Application, name stri

uploadCompacted := cmd.Flag("shipper.upload-compacted", "[Experimental] If true sidecar will try to upload compacted blocks as well. Useful for migration purposes. Works only if compaction is disabled on Prometheus.").Default("false").Hidden().Bool()

validateProm := cmd.Flag("sidecar.validate-prom", "[Experimental]If true sidecar will check Prometheus' flags to ensure disabled compaction and 2h block-time.").Default("true").Hidden().Bool()
validateProm := cmd.Flag("sidecar.validate-prom", "If true sidecar will check Prometheus' flags to ensure disabled compaction and 2h block-time.").Default("true").Hidden().Bool()

m[name] = func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ bool) error {
rl := reloader.New(
Expand Down Expand Up @@ -341,15 +341,12 @@ func runSidecar(
func validatePrometheus(ctx context.Context, logger log.Logger, promURL *url.URL, tsdbPath string) error {
flags, err := promclient.ConfiguredFlags(ctx, logger, promURL)
if err != nil {
return errors.Wrap(err, "configured flags; failed to check flags")
return errors.Wrap(err, "failed to check flags")
}
// Check if min-block-time and max-block-time are the same.
if flags.TSDBMinTime != flags.TSDBMaxTime {
return errors.New("TSDB Min-block-time mismatches with Max-block-time")
}
// Check if block-time equals 2h.
if flags.TSDBMinTime != model.Duration(2*time.Hour) {
level.Warn(logger).Log("msg", "TSDB Max-block-time and Min-block-time should be configured to 2h", "block-time", flags.TSDBMinTime)
// 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) {
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)
}

return nil
Expand Down
6 changes: 1 addition & 5 deletions pkg/promclient/promclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ import (
"gopkg.in/yaml.v2"
)

var FlagsVersion *version.Version

func init() {
FlagsVersion, _ = version.NewVersion("2.2.0")
}
var FlagsVersion = version.Must(version.NewVersion("2.2.0"))

// IsWALFileAccesible returns no error if WAL dir can be found. This helps to tell
// if we have access to Prometheus TSDB directory.
Expand Down
2 changes: 1 addition & 1 deletion pkg/shipper/shipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func NewWithCompacted(

if flags.TSDBMinTime != model.Duration(2*time.Hour) || flags.TSDBMaxTime != model.Duration(2*time.Hour) {
return nil, errors.Errorf("Found that TSDB Max time is %s and Min time is %s. To use shipper with upload compacted option, "+
"compaction needs to be disabled (storage.tsdb.min-block-duration = storage.tsdb.max-block-duration = 2h", flags.TSDBMinTime, flags.TSDBMaxTime)
"compaction needs to be disabled (storage.tsdb.min-block-duration = storage.tsdb.max-block-duration = 2h)", flags.TSDBMaxTime, flags.TSDBMinTime)
}

return &Shipper{
Expand Down

0 comments on commit 8e9499b

Please sign in to comment.