MCPcopy Create free account
hub / github.com/cortexproject/cortex / queueRequest

Method queueRequest

pkg/frontend/v1/frontend.go:356–377  ·  view source on GitHub ↗
(ctx context.Context, req *request)

Source from the content-addressed store, hash-verified

354}
355
356func (f *Frontend) queueRequest(ctx context.Context, req *request) error {
357 tenantIDs, err := users.TenantIDs(ctx)
358 if err != nil {
359 return err
360 }
361
362 now := time.Now()
363 req.enqueueTime = now
364 req.queueSpan, _ = opentracing.StartSpanFromContext(ctx, "queued")
365
366 // aggregate the max queriers limit in the case of a multi tenant query
367 maxQueriers := validation.SmallestPositiveNonZeroFloat64PerTenant(tenantIDs, f.limits.MaxQueriersPerUser)
368
369 joinedTenantID := users.JoinTenantIDs(tenantIDs)
370 f.activeUsers.UpdateUserTimestamp(joinedTenantID, now)
371
372 err = f.requestQueue.EnqueueRequest(joinedTenantID, req, maxQueriers, nil)
373 if err == queue.ErrTooManyRequests {
374 return errTooManyRequest
375 }
376 return err
377}
378
379// CheckReady determines if the query frontend is ready. Function parameters/return
380// chosen to match the same method in the ingester

Callers 3

RoundTripGRPCMethod · 0.95
TestRoundRobinQueuesFunction · 0.80

Calls 5

TenantIDsFunction · 0.92
JoinTenantIDsFunction · 0.92
EnqueueRequestMethod · 0.80
UpdateUserTimestampMethod · 0.45

Tested by 2

TestRoundRobinQueuesFunction · 0.64