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

Function BenchmarkTraceToParquet

tempodb/encoding/vparquet4/schema_test.go:934–957  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

932var benchmarkTrace *Trace
933
934func BenchmarkTraceToParquet(b *testing.B) {
935 var (
936 traceID = test.ValidTraceID(nil)
937 traces = make([]*tempopb.Trace, 0, 1_000)
938 parquetTraces = make([]*Trace, 11)
939 )
940
941 for range 1_000 {
942 nb := 20 + rand.Intn(5)
943 id := test.ValidTraceID(nil)
944 traces = append(traces, test.AddDedicatedAttributes(test.MakeTrace(nb, test.ValidTraceID(id))))
945 }
946
947 b.ResetTimer()
948 b.ReportAllocs()
949
950 for i := range b.N {
951 t := traces[i%len(traces)]
952 pt := parquetTraces[i%len(parquetTraces)]
953
954 traceToParquet(&backend.BlockMeta{}, traceID, t, pt)
955 benchmarkTrace = pt // prevent the compiler from optimizing out the above call
956 }
957}
958
959func tempopbTraceEqual(t *testing.T, expected, actual *tempopb.Trace) {
960 sortAttributesTempopb(expected)

Callers

nothing calls this directly

Calls 4

ValidTraceIDFunction · 0.92
AddDedicatedAttributesFunction · 0.92
MakeTraceFunction · 0.92
traceToParquetFunction · 0.70

Tested by

no test coverage detected