MCPcopy
hub / github.com/grafana/tempo / makeBackendBlockWithTraces

Function makeBackendBlockWithTraces

tempodb/encoding/vparquet3/block_search_test.go:257–293  ·  view source on GitHub ↗
(t *testing.T, trs []*Trace)

Source from the content-addressed store, hash-verified

255}
256
257func makeBackendBlockWithTraces(t *testing.T, trs []*Trace) *backendBlock {
258 rawR, rawW, _, err := local.New(&local.Config{
259 Path: t.TempDir(),
260 })
261 require.NoError(t, err)
262
263 r := backend.NewReader(rawR)
264 w := backend.NewWriter(rawW)
265 ctx := context.Background()
266
267 cfg := &common.BlockConfig{
268 BloomFP: 0.01,
269 BloomShardSizeBytes: 100 * 1024,
270 }
271
272 meta := backend.NewBlockMeta("fake", uuid.New(), VersionString)
273 meta.TotalObjects = 1
274 meta.DedicatedColumns = test.MakeDedicatedColumns()
275
276 s, newMeta := newStreamingBlock(ctx, cfg, meta, r, w, tempo_io.NewBufferedWriter)
277
278 for i, tr := range trs {
279 err = s.Add(tr, 0, 0)
280 require.NoError(t, err)
281 if i%100 == 0 {
282 _, err := s.Flush()
283 require.NoError(t, err)
284 }
285 }
286
287 _, err = s.Complete()
288 require.NoError(t, err)
289
290 b := newBackendBlock(newMeta, r)
291
292 return b
293}
294
295func makeTraces() ([]*Trace, map[string]string, map[string]string, map[string]string) {
296 traces := []*Trace{}

Calls 10

NewFunction · 0.92
NewReaderFunction · 0.92
NewWriterFunction · 0.92
NewBlockMetaFunction · 0.92
MakeDedicatedColumnsFunction · 0.92
newStreamingBlockFunction · 0.70
newBackendBlockFunction · 0.70
AddMethod · 0.65
FlushMethod · 0.65
CompleteMethod · 0.45

Tested by

no test coverage detected