Skip to content

Commit

Permalink
Fix poller waitgroup handling (#3224)
Browse files Browse the repository at this point in the history
* Fix poller waitgroup handling

* Update changelog
  • Loading branch information
zalegrala authored Dec 11, 2023
1 parent 70608af commit 56fbbcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* [BUGFIX] Change exit code if config is successfully verified [#3174](https://github.com/grafana/tempo/pull/3174) (@am3o @agrib-01)
* [BUGFIX] The tempo-cli analyse blocks command no longer fails on compacted blocks [#3183](https://github.com/grafana/tempo/pull/3183) (@stoewer)
* [BUGFIX] Move waitgroup handling for poller error condition [#3224](https://github.com/grafana/tempo/pull/3224) (@zalegrala)
* [ENHANCEMENT] Introduced `AttributePolicyMatch` & `IntrinsicPolicyMatch` structures to match span attributes based on strongly typed values & precompiled regexp [#3025](https://github.com/grafana/tempo/pull/3025) (@andriusluk)
* [CHANGE] TraceQL/Structural operators performance improvement. [#3088](https://github.com/grafana/tempo/pull/3088) (@joe-elliott)
* [CHANGE] Merge the processors overrides set through runtime overrides and user-configurable overrides [#3125](https://github.com/grafana/tempo/pull/3125) (@kvrhdn)
Expand Down
12 changes: 8 additions & 4 deletions tempodb/blocklist/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -335,6 +336,7 @@ func (p *Poller) pollUnknown(
defer span.Finish()

var (
err error
errs []error
mtx sync.Mutex
bg = boundedwaitgroup.New(p.cfg.PollConcurrency)
Expand All @@ -343,8 +345,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 {
Expand All @@ -353,6 +353,7 @@ func (p *Poller) pollUnknown(
}
mtx.Unlock()

bg.Add(1)
go func(id uuid.UUID, compacted bool) {
defer bg.Done()

Expand Down Expand Up @@ -383,8 +384,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
Expand Down

0 comments on commit 56fbbcd

Please sign in to comment.