Skip to content

Commit

Permalink
fix benchmark test
Browse files Browse the repository at this point in the history
Signed-off-by: glightfoot <[email protected]>
  • Loading branch information
glightfoot committed Jun 11, 2020
1 parent 5c0b206 commit 063112b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion exporter_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"testing"

"github.com/go-kit/kit/log"

"github.com/prometheus/statsd_exporter/pkg/event"
"github.com/prometheus/statsd_exporter/pkg/exporter"
"github.com/prometheus/statsd_exporter/pkg/listener"
Expand All @@ -38,6 +39,7 @@ func benchmarkUDPListener(times int, b *testing.B) {
"some_very_useful_metrics_with_quite_a_log_name:13|c",
}
bytesInput := make([]string, len(input)*times)
logger := log.NewNopLogger()
for run := 0; run < times; run++ {
for i := 0; i < len(input); i++ {
bytesInput[run*len(input)+i] = fmt.Sprintf("run%d%s", run, input[i])
Expand All @@ -46,7 +48,15 @@ func benchmarkUDPListener(times int, b *testing.B) {
for n := 0; n < b.N; n++ {
// there are more events than input lines, need bigger buffer
events := make(chan event.Events, len(bytesInput)*times*2)
l := listener.StatsDUDPListener{EventHandler: &event.UnbufferedEventHandler{C: events}}

l := listener.StatsDUDPListener{
EventHandler: &event.UnbufferedEventHandler{C: events},
Logger: logger,
UDPPackets: udpPackets,
LinesReceived: linesReceived,
SamplesReceived: samplesReceived,
TagsReceived: tagsReceived,
}

for i := 0; i < times; i++ {
for _, line := range bytesInput {
Expand Down

0 comments on commit 063112b

Please sign in to comment.