mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* o7 compactor Signed-off-by: Joe Elliott <[email protected]> * wip: o7 v2 Signed-off-by: Joe Elliott <[email protected]> * test cleanup Signed-off-by: Joe Elliott <[email protected]> * remove compactor from jsonnet Signed-off-by: Joe Elliott <[email protected]> * changelog Signed-off-by: Joe Elliott <[email protected]> * gen manifest Signed-off-by: Joe Elliott <[email protected]> * config cleanup Signed-off-by: Joe Elliott <[email protected]> * docs Signed-off-by: Joe Elliott <[email protected]> * jsonnet Signed-off-by: Joe Elliott <[email protected]> * remove encoding Signed-off-by: Joe Elliott <[email protected]> * remove data encoding Signed-off-by: Joe Elliott <[email protected]> * lint and cleanup Signed-off-by: Joe Elliott <[email protected]> * unflake TestWorker\? Signed-off-by: Joe Elliott <[email protected]> --------- Signed-off-by: Joe Elliott <[email protected]>
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
package test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/grafana/tempo/tempodb/backend"
|
|
"github.com/grafana/tempo/tempodb/backend/local"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func BenchmarkIndexLoad(b *testing.B) {
|
|
var (
|
|
tenant = "benchmark-tenant"
|
|
ctx = context.Background()
|
|
)
|
|
|
|
blockMeta := make([]*backend.BlockMeta, 1000)
|
|
for i := range len(blockMeta) {
|
|
blockMeta[i] = &backend.BlockMeta{
|
|
Version: "vParquet3",
|
|
BlockID: backend.NewUUID(),
|
|
TenantID: tenant,
|
|
StartTime: time.Now().Add(-50 * time.Minute),
|
|
EndTime: time.Now().Add(-40 * time.Minute),
|
|
TotalObjects: 10,
|
|
Size_: 12345,
|
|
CompactionLevel: 1,
|
|
IndexPageSize: 250000,
|
|
TotalRecords: 124356,
|
|
BloomShardCount: 244,
|
|
FooterSize: 15775,
|
|
DedicatedColumns: backend.DedicatedColumns{
|
|
{Scope: "resource", Name: "namespace", Type: "string"},
|
|
{Scope: "span", Name: "http.method", Type: "string"},
|
|
{Scope: "span", Name: "namespace", Type: "string"},
|
|
},
|
|
}
|
|
}
|
|
|
|
rr, rw, _, err := local.New(&local.Config{
|
|
Path: "./test-data",
|
|
})
|
|
require.NoError(b, err)
|
|
|
|
w := backend.NewWriter(rw)
|
|
err = w.WriteTenantIndex(ctx, tenant, blockMeta, nil)
|
|
require.NoError(b, err)
|
|
|
|
r := backend.NewReader(rr)
|
|
_, _ = r.TenantIndex(ctx, tenant) // read the index once to prime the cache
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
_, _ = r.TenantIndex(ctx, tenant)
|
|
}
|
|
}
|