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

Function populateBackend

integration/storage/backend_scheduler_test.go:437–468  ·  view source on GitHub ↗
(ctx context.Context, t testing.TB, w tempodb.Writer, tenantCount, blockCount, recordCount int)

Source from the content-addressed store, hash-verified

435}
436
437func populateBackend(ctx context.Context, t testing.TB, w tempodb.Writer, tenantCount, blockCount, recordCount int) []string {
438 wal := w.WAL()
439
440 dec := model.MustNewSegmentDecoder(model.CurrentEncoding)
441
442 tenants := make([]string, tenantCount)
443
444 for i := range tenantCount {
445 tenantID := tenant + strconv.Itoa(i)
446
447 tenants[i] = tenantID
448
449 for range blockCount {
450 blockID := backend.NewUUID()
451 meta := &backend.BlockMeta{BlockID: blockID, TenantID: tenantID}
452 head, err := wal.NewBlock(meta, model.CurrentEncoding)
453 require.NoError(t, err)
454
455 for range recordCount {
456 id := test.ValidTraceID(nil)
457 req := test.MakeTrace(10, id)
458
459 writeTraceToWal(t, head, dec, id, req, 0, 0)
460 }
461
462 _, err = w.CompleteBlock(ctx, head)
463 require.NoError(t, err)
464 }
465 }
466
467 return tenants
468}
469
470func writeTraceToWal(t require.TestingT, b common.WALBlock, dec model.SegmentDecoder, id common.ID, tr *tempopb.Trace, start, end uint32) {
471 b1, err := dec.PrepareForWrite(tr, 0, 0)

Callers 1

TestBackendSchedulerFunction · 0.85

Calls 8

MustNewSegmentDecoderFunction · 0.92
NewUUIDFunction · 0.92
ValidTraceIDFunction · 0.92
MakeTraceFunction · 0.92
NewBlockMethod · 0.80
writeTraceToWalFunction · 0.70
WALMethod · 0.65
CompleteBlockMethod · 0.65

Tested by

no test coverage detected