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

Function BenchmarkGeneratorDecoderOTLP

pkg/ingest/encoding_test.go:180–197  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

178}
179
180func BenchmarkGeneratorDecoderOTLP(b *testing.B) {
181 traceBytes := marshalBatches(b, []*v1.ResourceSpans{
182 test.MakeBatch(15, []byte("test batch 1")),
183 test.MakeBatch(50, []byte("test batch 2")),
184 test.MakeBatch(42, []byte("test batch 3")),
185 })
186
187 b.ReportAllocs()
188 decoder := NewOTLPDecoder()
189
190 b.ResetTimer()
191 for b.Loop() {
192 iterator, err := decoder.Decode(traceBytes)
193 require.NoError(b, err)
194 for range iterator { // nolint:revive // we want to run the side effects of ranging itself
195 }
196 }
197}
198
199func marshalBatches(t testing.TB, batches []*v1.ResourceSpans) []byte {
200 t.Helper()

Callers

nothing calls this directly

Calls 5

DecodeMethod · 0.95
MakeBatchFunction · 0.92
marshalBatchesFunction · 0.85
NewOTLPDecoderFunction · 0.85
LoopMethod · 0.80

Tested by

no test coverage detected