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

Function makeBackendBlockWithTraces

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

Source from the content-addressed store, hash-verified

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