Skip to content

Commit

Permalink
change upload
Browse files Browse the repository at this point in the history
  • Loading branch information
yeya24 committed Apr 5, 2019
1 parent f800a36 commit 880bb8b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cmd/thanos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ func runSidecar(
maxt: math.MaxInt64,
}

confContentYaml, err := objStoreConfig.Content()
if err != nil {
return err
}

var uploads = true
if len(confContentYaml) == 0 {
level.Info(logger).Log("msg", "No supported bucket was configured, uploads will be disabled")
uploads = false
}

// Setup all the concurrent groups.
{
promUp := prometheus.NewGauge(prometheus.GaugeOpts{
Expand All @@ -129,7 +140,7 @@ func runSidecar(
ctx, cancel := context.WithCancel(context.Background())
g.Add(func() error {
// Only check Prometheus's flags when upload is enabled.
if uploadCompacted {
if uploads {
// Retry infinitely until we get Prometheus version.
if err := runutil.Retry(2*time.Second, ctx.Done(), func() error {
if err := m.FetchPromVersion(logger); err != nil {
Expand All @@ -150,7 +161,7 @@ func runSidecar(
return errors.Wrap(err, "validate Prometheus flags")
}
} else {
level.Info(logger).Log("msg", "uploading compacted blocks is disabled, skip validation")
level.Info(logger).Log("msg", "uploading blocks is disabled, skip validation")
}

// Blocking query of external labels before joining as a Source Peer into gossip.
Expand Down Expand Up @@ -257,17 +268,6 @@ func runSidecar(
})
}

confContentYaml, err := objStoreConfig.Content()
if err != nil {
return err
}

var uploads = true
if len(confContentYaml) == 0 {
level.Info(logger).Log("msg", "No supported bucket was configured, uploads will be disabled")
uploads = false
}

if uploads {
// The background shipper continuously scans the data directory and uploads
// new blocks to Google Cloud Storage or an S3-compatible storage service.
Expand Down

0 comments on commit 880bb8b

Please sign in to comment.