queryChunks runs a matcher query against the querier and expands its data.
(t testing.TB, q storage.ChunkQuerier, matchers ...*labels.Matcher)
| 208 | |
| 209 | // queryChunks runs a matcher query against the querier and expands its data. |
| 210 | func 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. |
no test coverage detected
searching dependent graphs…