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

Method getBlocks

pkg/querier/parquet_queryable.go:600–631  ·  view source on GitHub ↗
(ctx context.Context, minT, maxT int64, matchers []*labels.Matcher)

Source from the content-addressed store, hash-verified

598}
599
600func (q *parquetQuerierWithFallback) getBlocks(ctx context.Context, minT, maxT int64, matchers []*labels.Matcher) ([]*bucketindex.Block, []*bucketindex.Block, error) {
601 userID, err := users.TenantID(ctx)
602 if err != nil {
603 return nil, nil, err
604 }
605
606 maxT = q.adjustMaxT(maxT)
607
608 if maxT < minT {
609 return nil, nil, nil
610 }
611
612 blocks, _, err := q.finder.GetBlocks(ctx, userID, minT, maxT, matchers)
613 if err != nil {
614 return nil, nil, err
615 }
616
617 useParquet := getBlockStoreType(ctx, q.defaultBlockStoreType) == parquetBlockStore
618 parquetBlocks := make([]*bucketindex.Block, 0, len(blocks))
619 remaining := make([]*bucketindex.Block, 0, len(blocks))
620 for _, b := range blocks {
621 if useParquet && b.Parquet != nil {
622 parquetBlocks = append(parquetBlocks, b)
623 continue
624 }
625 remaining = append(remaining, b)
626 }
627
628 q.metrics.blocksQueriedTotal.WithLabelValues("parquet").Add(float64(len(parquetBlocks)))
629 q.metrics.blocksQueriedTotal.WithLabelValues("tsdb").Add(float64(len(remaining)))
630 return remaining, parquetBlocks, nil
631}
632
633func (q *parquetQuerierWithFallback) incrementOpsMetric(method string, remaining []*bucketindex.Block, parquetBlocks []*bucketindex.Block) {
634 switch {

Callers 3

LabelValuesMethod · 0.95
LabelNamesMethod · 0.95
SelectMethod · 0.95

Calls 5

adjustMaxTMethod · 0.95
TenantIDFunction · 0.92
getBlockStoreTypeFunction · 0.85
GetBlocksMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected