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

Function BenchmarkLiveTracesWrite

pkg/livetraces/livetraces_test.go:153–168  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

151}
152
153func BenchmarkLiveTracesWrite(b *testing.B) {
154 lt := New(func(rs *v1.ResourceSpans) uint64 { return uint64(rs.Size()) }, 0, 0, testTenantID)
155
156 var traces []*tempopb.Trace
157 for i := 0; i < 100_000; i++ {
158 traces = append(traces, test.MakeTrace(1, nil))
159 }
160
161 b.ResetTimer()
162
163 for i := 0; i < b.N; i++ {
164 for _, tr := range traces {
165 lt.Push(tr.ResourceSpans[0].ScopeSpans[0].Spans[0].TraceId, tr.ResourceSpans[0], 0)
166 }
167 }
168}
169
170func BenchmarkLiveTracesRead(b *testing.B) {
171 lt := New(func(rs *v1.ResourceSpans) uint64 { return uint64(rs.Size()) }, 0, 0, testTenantID)

Callers

nothing calls this directly

Calls 4

MakeTraceFunction · 0.92
NewFunction · 0.70
SizeMethod · 0.65
PushMethod · 0.45

Tested by

no test coverage detected