MCPcopy
hub / github.com/prometheus/prometheus / queryChunks

Function queryChunks

tsdb/db_test.go:210–238  ·  view source on GitHub ↗

queryChunks runs a matcher query against the querier and expands its data.

(t testing.TB, q storage.ChunkQuerier, matchers ...*labels.Matcher)

Source from the content-addressed store, hash-verified

208
209// queryChunks runs a matcher query against the querier and expands its data.
210func queryChunks(t testing.TB, q storage.ChunkQuerier, matchers ...*labels.Matcher) map[string][]chunks.Meta {
211 ss := q.Select(context.Background(), false, nil, matchers...)
212 defer func() {
213 require.NoError(t, q.Close())
214 }()
215
216 var it chunks.Iterator
217 result := map[string][]chunks.Meta{}
218 for ss.Next() {
219 series := ss.At()
220
221 chks := []chunks.Meta{}
222 it = series.Iterator(it)
223 for it.Next() {
224 chks = append(chks, it.At())
225 }
226 require.NoError(t, it.Err())
227
228 if len(chks) == 0 {
229 continue
230 }
231
232 name := series.Labels().String()
233 result[name] = chks
234 }
235 require.NoError(t, ss.Err())
236 require.Empty(t, ss.Warnings())
237 return result
238}
239
240// Ensure that blocks are held in memory in their time order
241// and not in ULID order as they are read from the directory.

Calls 9

NextMethod · 0.95
AtMethod · 0.95
ErrMethod · 0.95
SelectMethod · 0.65
CloseMethod · 0.65
IteratorMethod · 0.65
StringMethod · 0.65
LabelsMethod · 0.65
WarningsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…