(b *testing.B)
| 178 | } |
| 179 | |
| 180 | func 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 | |
| 199 | func marshalBatches(t testing.TB, batches []*v1.ResourceSpans) []byte { |
| 200 | t.Helper() |
nothing calls this directly
no test coverage detected