Skip to content

Commit

Permalink
fix: detected labels panic if no interval returned
Browse files Browse the repository at this point in the history
  • Loading branch information
svennergr committed Apr 3, 2024
1 parent d39dc09 commit 7cb467b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ func (q *SingleTenantQuerier) DetectedLabels(ctx context.Context, req *logproto.

g, ctx := errgroup.WithContext(ctx)
ingesterQueryInterval, _ := q.buildQueryIntervals(*req.Start, *req.End)
if !q.cfg.QueryStoreOnly {
if !q.cfg.QueryStoreOnly && ingesterQueryInterval != nil {
g.Go(func() error {
var err error
splitReq := *req
Expand All @@ -932,6 +932,12 @@ func (q *SingleTenantQuerier) DetectedLabels(ctx context.Context, req *logproto.
return nil, err
}

if ingesterLabels == nil {
return &logproto.DetectedLabelsResponse{
DetectedLabels: []*logproto.DetectedLabel{},
}, nil
}

for label, values := range ingesterLabels.Labels {
if q.isLabelRelevant(label, values) {
detectedLabels = append(detectedLabels, &logproto.DetectedLabel{Label: label, Cardinality: uint64(len(values.Values))})
Expand Down

0 comments on commit 7cb467b

Please sign in to comment.