Skip to content

Commit

Permalink
Enforce some validations and timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
shantanualsi committed Apr 3, 2024
1 parent 1b65c4b commit 28f3c4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,15 @@ func (q *SingleTenantQuerier) DetectedLabels(ctx context.Context, req *logproto.
}
var detectedLabels []*logproto.DetectedLabel

// Enforce the query timeout while querying backends
queryTimeout := q.limits.QueryTimeout(ctx, userID)
ctx, cancel := context.WithDeadline(ctx, time.Now().Add(queryTimeout))
defer cancel()
g, ctx := errgroup.WithContext(ctx)

if *req.Start, *req.End, err = validateQueryTimeRangeLimits(ctx, userID, q.limits, *req.Start, *req.End); err != nil {
return nil, err
}
ingesterQueryInterval, storeQueryInterval := q.buildQueryIntervals(*req.Start, *req.End)

var ingesterLabels *logproto.LabelToValuesResponse
Expand All @@ -930,7 +938,6 @@ func (q *SingleTenantQuerier) DetectedLabels(ctx context.Context, req *logproto.
splitReq.End = &ingesterQueryInterval.end

ingesterLabels, err = q.ingesterQuerier.DetectedLabel(ctx, &splitReq)
level.Info(q.logger).Log("msg", ingesterLabels)
return err
})
}
Expand Down

0 comments on commit 28f3c4e

Please sign in to comment.