Skip to content

Commit

Permalink
comment on return value
Browse files Browse the repository at this point in the history
  • Loading branch information
flxbk committed Jan 11, 2024
1 parent 29ba882 commit a50c233
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1832,13 +1832,17 @@ func (d *Distributor) ActiveSeries(ctx context.Context, matchers []*labels.Match
res := newActiveSeriesResponse(d.hashCollisionCount, maxResponseSize)

ingesterQuery := func(ctx context.Context, client ingester_client.IngesterClient) (any, error) {
// This function is invoked purely for its side effects on the captured
// activeSeriesResponse, its return value is never used.
type ignored struct{}

log, ctx := spanlogger.NewWithLogger(ctx, d.log, "Distributor.ActiveSeries.queryIngester")
defer log.Finish()

stream, err := client.ActiveSeries(ctx, req)
if err != nil {
if errors.Is(err, context.Canceled) {
return nil, nil
return ignored{}, nil
}
level.Error(log).Log("msg", "error creating active series response stream", "err", err)
ext.Error.Set(log.Span, true)
Expand All @@ -1859,7 +1863,7 @@ func (d *Distributor) ActiveSeries(ctx context.Context, matchers []*labels.Match
break
}
if errors.Is(err, context.Canceled) {
return nil, nil
return ignored{}, nil
}
level.Error(log).Log("msg", "error receiving active series response", "err", err)
ext.Error.Set(log.Span, true)
Expand All @@ -1872,7 +1876,7 @@ func (d *Distributor) ActiveSeries(ctx context.Context, matchers []*labels.Match
}
}

return nil, nil
return ignored{}, nil
}

_, err = forReplicationSet(ctx, d, replicationSet, ingesterQuery)
Expand Down

0 comments on commit a50c233

Please sign in to comment.