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

Function BenchmarkTestsByRequestID

modules/distributor/distributor_test.go:1182–1212  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1180}
1181
1182func BenchmarkTestsByRequestID(b *testing.B) {
1183 spansPer := 5000
1184 batches := 100
1185 traces := []*tempopb.Trace{
1186 test.MakeTraceWithSpanCount(batches, spansPer, []byte{0x0A, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}),
1187 test.MakeTraceWithSpanCount(batches, spansPer, []byte{0x0B, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}),
1188 test.MakeTraceWithSpanCount(batches, spansPer, []byte{0x0C, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}),
1189 test.MakeTraceWithSpanCount(batches, spansPer, []byte{0x0D, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}),
1190 }
1191 ils := make([][]*v1.ScopeSpans, batches)
1192
1193 for i := 0; i < batches; i++ {
1194 for _, t := range traces {
1195 ils[i] = append(ils[i], t.ResourceSpans[i].ScopeSpans...)
1196 }
1197 }
1198
1199 b.ResetTimer()
1200 b.ReportAllocs()
1201
1202 for i := 0; i < b.N; i++ {
1203 for _, blerg := range ils {
1204 _, _, _, _, err := requestsByTraceID([]*v1.ResourceSpans{
1205 {
1206 ScopeSpans: blerg,
1207 },
1208 }, "test", spansPer*len(traces), 5)
1209 require.NoError(b, err)
1210 }
1211 }
1212}
1213
1214func TestDistributor(t *testing.T) {
1215 for i, tc := range []struct {

Callers

nothing calls this directly

Calls 2

MakeTraceWithSpanCountFunction · 0.92
requestsByTraceIDFunction · 0.85

Tested by

no test coverage detected