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

Function BenchmarkTraceToParquet

tempodb/encoding/vparquet5/schema_test.go:960–983  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

958var benchmarkTrace *Trace
959
960func BenchmarkTraceToParquet(b *testing.B) {
961 var (
962 traceID = test.ValidTraceID(nil)
963 traces = make([]*tempopb.Trace, 0, 1_000)
964 parquetTraces = make([]*Trace, 11)
965 )
966
967 for range 1_000 {
968 nb := 20 + rand.Intn(5)
969 id := test.ValidTraceID(nil)
970 traces = append(traces, test.AddDedicatedAttributes(test.MakeTrace(nb, test.ValidTraceID(id))))
971 }
972
973 b.ResetTimer()
974 b.ReportAllocs()
975
976 for i := range b.N {
977 t := traces[i%len(traces)]
978 pt := parquetTraces[i%len(parquetTraces)]
979
980 traceToParquet(&backend.BlockMeta{}, traceID, t, pt)
981 benchmarkTrace = pt // prevent the compiler from optimizing out the above call
982 }
983}
984
985func tempopbTraceEqual(t *testing.T, expected, actual *tempopb.Trace) {
986 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