Skip to content

Commit

Permalink
use RunParallel
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <aboten@lightstep.com>
  • Loading branch information
Alex Boten committed May 23, 2023
1 parent 47cf21b commit dcb847a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions processor/batchprocessor/batch_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,16 +634,12 @@ func runMetricsProcessorBenchmark(b *testing.B, cfg Config) {
require.NoError(b, err)
require.NoError(b, batcher.Start(ctx, componenttest.NewNopHost()))

mds := make([]pmetric.Metrics, 0, b.N)
for n := 0; n < b.N; n++ {
mds = append(mds,
testdata.GenerateMetrics(metricsPerRequest),
)
}
b.StartTimer()
for n := 0; n < b.N; n++ {
require.NoError(b, batcher.ConsumeMetrics(ctx, mds[n]))
}
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
require.NoError(b, batcher.ConsumeMetrics(ctx, testdata.GenerateMetrics(metricsPerRequest)))
}
})
b.StopTimer()
require.NoError(b, batcher.Shutdown(ctx))
require.Equal(b, b.N*metricsPerRequest, sink.metricsCount)
Expand Down

0 comments on commit dcb847a

Please sign in to comment.