Skip to content

Commit

Permalink
fix: composable parallel router tracing by index (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann authored Jun 24, 2024
1 parent 77f4db3 commit 263523c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compparallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package routinghelpers
import (
"context"
"errors"
"fmt"
"reflect"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -387,7 +386,7 @@ func getChannelOrErrorParallel[T any](
blocking.Add(1) // start at one so we don't cancel while dispatching
var sent atomic.Bool

for _, r := range routers {
for i, r := range routers {
ctx, span := tracer.StartSpan(ctx, composeName+".worker")
isBlocking := !isSearchValue || !r.DoNotWaitForSearchValue
if isBlocking {
Expand All @@ -398,7 +397,7 @@ func getChannelOrErrorParallel[T any](
span.SetAttributes(
attribute.Bool("blocking", isBlocking),
attribute.Stringer("type", reflect.TypeOf(r.Router)),
attribute.String("string", fmt.Sprint(r.Router)),
attribute.Int("routingNumber", i),
)
}

Expand Down

0 comments on commit 263523c

Please sign in to comment.