Skip to content

Commit

Permalink
sidecar: wait on ext labels before uploading (#1287)
Browse files Browse the repository at this point in the history
* wait on ext labels before uploading

* bump timeout
  • Loading branch information
Martin Dickson authored and bwplotka committed Jul 5, 2019
1 parent 4f32761 commit 51e2ab8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/thanos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,17 @@ func runSidecar(
g.Add(func() error {
defer runutil.CloseWithLogOnErr(logger, bkt, "bucket client")

extLabelsTimeout := 10 * time.Minute
extLabelsCtx, _ := context.WithTimeout(ctx, extLabelsTimeout)
if err := runutil.Retry(2*time.Second, extLabelsCtx.Done(), func() error {
if len(m.Labels()) == 0 {
return errors.New("not uploading as no external labels are configured yet - is Prometheus healthy/reachable?")
}
return nil
}); err != nil {
return errors.Wrapf(err, "aborting as no external labels found after waiting %s", extLabelsTimeout)
}

var s *shipper.Shipper
if uploadCompacted {
s = shipper.NewWithCompacted(logger, reg, dataDir, bkt, m.Labels, metadata.SidecarSource)
Expand Down

0 comments on commit 51e2ab8

Please sign in to comment.