Skip to content

Commit

Permalink
fix: null check the span logger
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Nov 15, 2024
1 parent 235473c commit 6e6597f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,20 @@ func (d *Distributor) Push(ctx context.Context, req *logproto.PushRequest) (*log
maybeShardStreams(stream, lbs, pushSize)
}

sp.LogKV(fmt.Sprintf("number of stream labels sampled in distributor (limited to %d)", streamSampleSize), len(streamLblSample))
streamLblsSampleSlice := make([]string, 0, len(streamLblSample))
for k := range streamLblSample {
streamLblsSampleSlice = append(streamLblsSampleSlice, k)
if sp != nil {
sp.LogKV(
fmt.Sprintf(
"number of stream labels sampled in distributor (limited to %d)",
streamSampleSize,
),
len(streamLblSample),
)
streamLblsSampleSlice := make([]string, 0, len(streamLblSample))
for k := range streamLblSample {
streamLblsSampleSlice = append(streamLblsSampleSlice, k)
}
sp.LogKV("stream labels", strings.Join(streamLblsSampleSlice, ","))
}
sp.LogKV("stream labels", strings.Join(streamLblsSampleSlice, ","))
}()

var validationErr error
Expand Down

0 comments on commit 6e6597f

Please sign in to comment.