(ctx context.Context)
| 338 | } |
| 339 | |
| 340 | func (q querier) setupFromCtx(ctx context.Context) (context.Context, *querier_stats.QueryStats, string, int64, int64, storage.Querier, []storage.Querier, error) { |
| 341 | stats := querier_stats.FromContext(ctx) |
| 342 | userID, err := users.TenantID(ctx) |
| 343 | if err != nil { |
| 344 | return ctx, stats, userID, 0, 0, nil, nil, err |
| 345 | } |
| 346 | |
| 347 | q.limiterHolder.limiterInitializer.Do(func() { |
| 348 | q.limiterHolder.limiter = limiter.NewQueryLimiter(q.limits.MaxFetchedSeriesPerQuery(userID), q.limits.MaxFetchedChunkBytesPerQuery(userID), q.limits.MaxChunksPerQuery(userID), q.limits.MaxFetchedDataBytesPerQuery(userID)) |
| 349 | }) |
| 350 | |
| 351 | ctx = limiter.AddQueryLimiterToContext(ctx, q.limiterHolder.limiter) |
| 352 | |
| 353 | mint, maxt, err := validateQueryTimeRange(ctx, userID, q.mint, q.maxt, q.limits, q.maxQueryIntoFuture) |
| 354 | if err != nil { |
| 355 | return ctx, stats, userID, 0, 0, nil, nil, err |
| 356 | } |
| 357 | |
| 358 | dqr, err := q.distributor.Querier(mint, maxt) |
| 359 | if err != nil { |
| 360 | return ctx, stats, userID, 0, 0, nil, nil, err |
| 361 | } |
| 362 | metadataQuerier := dqr |
| 363 | |
| 364 | queriers := make([]storage.Querier, 0) |
| 365 | if q.distributor.UseQueryable(q.now, mint, maxt) { |
| 366 | queriers = append(queriers, dqr) |
| 367 | } |
| 368 | |
| 369 | for _, s := range q.stores { |
| 370 | if !s.UseQueryable(q.now, mint, maxt) { |
| 371 | continue |
| 372 | } |
| 373 | |
| 374 | cqr, err := s.Querier(mint, maxt) |
| 375 | if err != nil { |
| 376 | return ctx, stats, userID, 0, 0, nil, nil, err |
| 377 | } |
| 378 | |
| 379 | queriers = append(queriers, cqr) |
| 380 | } |
| 381 | return ctx, stats, userID, mint, maxt, metadataQuerier, queriers, nil |
| 382 | } |
| 383 | |
| 384 | // Select implements storage.Querier interface. |
| 385 | // The bool passed is ignored because the series is always sorted. |
no test coverage detected