MCPcopy
hub / github.com/prometheus/prometheus / newBlockBaseQuerierForSearch

Function newBlockBaseQuerierForSearch

tsdb/querier_test.go:4191–4207  ·  view source on GitHub ↗
(t *testing.T, labelSets ...labels.Labels)

Source from the content-addressed store, hash-verified

4189}
4190
4191func newBlockBaseQuerierForSearch(t *testing.T, labelSets ...labels.Labels) *blockBaseQuerier {
4192 t.Helper()
4193 ix := newMockIndex()
4194 // Group series refs by label for writing postings.
4195 postings := make(map[labels.Label][]storage.SeriesRef)
4196 for i, ls := range labelSets {
4197 ref := storage.SeriesRef(i)
4198 require.NoError(t, ix.AddSeries(ref, ls))
4199 ls.Range(func(lbl labels.Label) {
4200 postings[lbl] = append(postings[lbl], ref)
4201 })
4202 }
4203 for lbl, refs := range postings {
4204 require.NoError(t, ix.WritePostings(lbl.Name, lbl.Value, index.NewListPostings(refs)))
4205 }
4206 return &blockBaseQuerier{index: ix, chunks: nil, tombstones: tombstones.NewMemTombstones()}
4207}
4208
4209func collectSearchResultSet(t *testing.T, rs storage.SearchResultSet) []storage.SearchResult {
4210 t.Helper()

Calls 7

SeriesRefTypeAlias · 0.92
NewListPostingsFunction · 0.92
NewMemTombstonesFunction · 0.92
WritePostingsMethod · 0.80
newMockIndexFunction · 0.70
AddSeriesMethod · 0.65
RangeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…