Select implements storage.Querier interface. The bool passed is ignored because the series is always sorted.
(_ context.Context, _ bool, sp *storage.SelectHints, matchers ...*labels.Matcher)
| 1465 | // Select implements storage.Querier interface. |
| 1466 | // The bool passed is ignored because the series is always sorted. |
| 1467 | func (q *mockStoreQuerier) Select(_ context.Context, _ bool, sp *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet { |
| 1468 | // If we don't skip here, it'll make /series lookups extremely slow as all the chunks will be loaded. |
| 1469 | // That flag is only to be set with blocks storage engine, and this is a protective measure. |
| 1470 | if sp != nil && sp.Func == "series" { |
| 1471 | return storage.EmptySeriesSet() |
| 1472 | } |
| 1473 | |
| 1474 | chunks, err := q.store.Get() |
| 1475 | if err != nil { |
| 1476 | return storage.ErrSeriesSet(err) |
| 1477 | } |
| 1478 | |
| 1479 | cs := make([]storage.Series, 0, len(chunks)) |
| 1480 | chunksBySeries := map[string][]chunk.Chunk{} |
| 1481 | |
| 1482 | for _, c := range chunks { |
| 1483 | key := client.LabelsToKeyString(c.Metric) |
| 1484 | chunksBySeries[key] = append(chunksBySeries[key], c) |
| 1485 | } |
| 1486 | |
| 1487 | for i, c := range chunksBySeries { |
| 1488 | cs = append(cs, &storage.SeriesEntry{ |
| 1489 | Lset: chunksBySeries[i][0].Metric, |
| 1490 | SampleIteratorFn: func(it chunkenc.Iterator) chunkenc.Iterator { |
| 1491 | return q.chunkIteratorFunc(it, c, model.Time(mint), model.Time(maxt)) |
| 1492 | }, |
| 1493 | }) |
| 1494 | } |
| 1495 | |
| 1496 | return series.NewConcreteSeriesSet(true, cs) |
| 1497 | } |
| 1498 | |
| 1499 | func (q *mockStoreQuerier) LabelValues(ctx context.Context, name string, _ *storage.LabelHints, labels ...*labels.Matcher) ([]string, annotations.Annotations, error) { |
| 1500 | return nil, nil, nil |
nothing calls this directly
no test coverage detected