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

Function BenchmarkLiveTracesRead

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

Source from the content-addressed store, hash-verified

168}
169
170func BenchmarkLiveTracesRead(b *testing.B) {
171 lt := New(func(rs *v1.ResourceSpans) uint64 { return uint64(rs.Size()) }, 0, 0, testTenantID)
172
173 for i := 0; i < 100_000; i++ {
174 tr := test.MakeTrace(1, nil)
175 lt.Push(tr.ResourceSpans[0].ScopeSpans[0].Spans[0].TraceId, tr.ResourceSpans[0], 0)
176 }
177
178 b.ResetTimer()
179
180 for i := 0; i < b.N; i++ {
181 // This won't cut anything, instead will benchmark the map iteration performance.
182 //nolint:revive
183 for range lt.CutIdle(time.Now().Add(-time.Hour), false) {
184 }
185 }
186}

Callers

nothing calls this directly

Calls 7

MakeTraceFunction · 0.92
CutIdleMethod · 0.80
NewFunction · 0.70
SizeMethod · 0.65
AddMethod · 0.65
NowMethod · 0.65
PushMethod · 0.45

Tested by

no test coverage detected