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

Function BenchmarkIndexLoad

tempodb/backend/test/benchmark_test.go:13–58  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

11)
12
13func BenchmarkIndexLoad(b *testing.B) {
14 var (
15 tenant = "benchmark-tenant"
16 ctx = context.Background()
17 )
18
19 blockMeta := make([]*backend.BlockMeta, 1000)
20 for i := range len(blockMeta) {
21 blockMeta[i] = &backend.BlockMeta{
22 Version: "vParquet3",
23 BlockID: backend.NewUUID(),
24 TenantID: tenant,
25 StartTime: time.Now().Add(-50 * time.Minute),
26 EndTime: time.Now().Add(-40 * time.Minute),
27 TotalObjects: 10,
28 Size_: 12345,
29 CompactionLevel: 1,
30 IndexPageSize: 250000,
31 TotalRecords: 124356,
32 BloomShardCount: 244,
33 FooterSize: 15775,
34 DedicatedColumns: backend.DedicatedColumns{
35 {Scope: "resource", Name: "namespace", Type: "string"},
36 {Scope: "span", Name: "http.method", Type: "string"},
37 {Scope: "span", Name: "namespace", Type: "string"},
38 },
39 }
40 }
41
42 rr, rw, _, err := local.New(&local.Config{
43 Path: "./test-data",
44 })
45 require.NoError(b, err)
46
47 w := backend.NewWriter(rw)
48 err = w.WriteTenantIndex(ctx, tenant, blockMeta, nil)
49 require.NoError(b, err)
50
51 r := backend.NewReader(rr)
52 _, _ = r.TenantIndex(ctx, tenant) // read the index once to prime the cache
53 b.ResetTimer()
54
55 for i := 0; i < b.N; i++ {
56 _, _ = r.TenantIndex(ctx, tenant)
57 }
58}

Callers

nothing calls this directly

Calls 8

WriteTenantIndexMethod · 0.95
TenantIndexMethod · 0.95
NewUUIDFunction · 0.92
NewFunction · 0.92
NewWriterFunction · 0.92
NewReaderFunction · 0.92
AddMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected