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

Function blockForBenchmarks

tempodb/encoding/vparquet4/block_traceql_test.go:2643–2671  ·  view source on GitHub ↗
(b testing.TB)

Source from the content-addressed store, hash-verified

2641}
2642
2643func blockForBenchmarks(b testing.TB) *backendBlock {
2644 id, ok := os.LookupEnv("BENCH_BLOCKID")
2645 if !ok {
2646 b.Fatal("BENCH_BLOCKID is not set. These benchmarks are designed to run against a block on local disk. Set BENCH_BLOCKID to the guid of the block to run benchmarks against. e.g. `export BENCH_BLOCKID=030c8c4f-9d47-4916-aadc-26b90b1d2bc4`")
2647 }
2648
2649 path, ok := os.LookupEnv("BENCH_PATH")
2650 if !ok {
2651 b.Fatal("BENCH_PATH is not set. These benchmarks are designed to run against a block on local disk. Set BENCH_PATH to the root of the backend such that the block to benchmark is at <BENCH_PATH>/<BENCH_TENANTID>/<BENCH_BLOCKID>.")
2652 }
2653
2654 tenantID, ok := os.LookupEnv("BENCH_TENANTID")
2655
2656 if !ok {
2657 tenantID = "1"
2658 }
2659
2660 blockID := uuid.MustParse(id)
2661 r, _, _, err := local.New(&local.Config{
2662 Path: path,
2663 })
2664 require.NoError(b, err)
2665
2666 rr := backend.NewReader(r)
2667 meta, err := rr.BlockMeta(context.Background(), blockID, tenantID)
2668 require.NoError(b, err)
2669
2670 return newBackendBlock(meta, rr)
2671}

Calls 4

BlockMetaMethod · 0.95
NewFunction · 0.92
NewReaderFunction · 0.92
newBackendBlockFunction · 0.70

Tested by

no test coverage detected