diff --git a/tempodb/blocklist/poller.go b/tempodb/blocklist/poller.go index b20df0f38f4..b7f59b5828f 100644 --- a/tempodb/blocklist/poller.go +++ b/tempodb/blocklist/poller.go @@ -14,6 +14,7 @@ import ( "github.com/go-kit/log/level" "github.com/google/uuid" opentracing "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/ext" spanlog "github.com/opentracing/opentracing-go/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -227,7 +228,6 @@ func (p *Poller) pollTenantAndCreateIndex( // if we're here then we have been configured to be a tenant index builder OR // there was a failure to pull the tenant index and we are configured to fall // back to polling. - metricTenantIndexBuilder.WithLabelValues(tenantID).Set(1) blocklist, compactedBlocklist, err := p.pollTenantBlocks(derivedCtx, tenantID, previous) if err != nil { return nil, nil, err @@ -335,6 +335,7 @@ func (p *Poller) pollUnknown( defer span.Finish() var ( + err error errs []error mtx sync.Mutex bg = boundedwaitgroup.New(p.cfg.PollConcurrency) @@ -343,8 +344,6 @@ func (p *Poller) pollUnknown( ) for blockID, compacted := range unknownBlocks { - bg.Add(1) - // Avoid polling if we've already encountered an error mtx.Lock() if len(errs) > 0 { @@ -353,6 +352,7 @@ func (p *Poller) pollUnknown( } mtx.Unlock() + bg.Add(1) go func(id uuid.UUID, compacted bool) { defer bg.Done() @@ -383,8 +383,11 @@ func (p *Poller) pollUnknown( if len(errs) > 0 { metricTenantIndexErrors.WithLabelValues(tenantID).Inc() - // TODO: add span status on error - return nil, nil, errors.Join(errs...) + err = errors.Join(errs...) + ext.Error.Set(span, true) + span.SetTag("err", err) + + return nil, nil, err } return newBlockList, newCompactedBlocklist, nil