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

Function testWalBlock

tempodb/encoding/vparquet5/wal_block_test.go:461–493  ·  view source on GitHub ↗
(t *testing.T, f func(w *walBlock, ids []common.ID, trs []*tempopb.Trace))

Source from the content-addressed store, hash-verified

459}
460
461func testWalBlock(t *testing.T, f func(w *walBlock, ids []common.ID, trs []*tempopb.Trace)) {
462 meta := backend.NewBlockMeta("fake", uuid.New(), VersionString)
463 w, err := createWALBlock(meta, t.TempDir(), model.CurrentEncoding, 0)
464 require.NoError(t, err)
465
466 decoder := model.MustNewSegmentDecoder(model.CurrentEncoding)
467
468 count := 30
469 ids := make([]common.ID, count)
470 trs := make([]*tempopb.Trace, count)
471 for i := 0; i < count; i++ {
472 ids[i] = test.ValidTraceID(nil)
473 trs[i] = test.MakeTrace(10, ids[i])
474 trace.SortTrace(trs[i])
475
476 b1, err := decoder.PrepareForWrite(trs[i], 0, 0)
477 require.NoError(t, err)
478
479 b2, err := decoder.ToObject([][]byte{b1})
480 require.NoError(t, err)
481
482 err = w.Append(ids[i], b2, 0, 0, true)
483 require.NoError(t, err)
484
485 if i%10 == 0 {
486 require.NoError(t, w.Flush())
487 }
488 }
489
490 require.NoError(t, w.Flush())
491
492 f(w, ids, trs)
493}
494
495func BenchmarkWalTraceQL(b *testing.B) {
496 reqs := []string{

Callers 4

TestWalBlockIteratorFunction · 0.70
TestRowIteratorFunction · 0.70

Calls 11

NewBlockMetaFunction · 0.92
MustNewSegmentDecoderFunction · 0.92
ValidTraceIDFunction · 0.92
MakeTraceFunction · 0.92
SortTraceFunction · 0.92
fFunction · 0.85
createWALBlockFunction · 0.70
PrepareForWriteMethod · 0.65
ToObjectMethod · 0.65
AppendMethod · 0.65
FlushMethod · 0.65

Tested by

no test coverage detected