in cmd/apmbench/bench.go [123:147]
func newEventHandler(tb testing.TB, p string, l *rate.Limiter) *eventhandler.Handler {
protocol := "apm/http"
if strings.HasPrefix(p, "otlp-") {
protocol = "otlp/http"
}
h, err := loadgen.NewEventHandler(loadgen.EventHandlerParams{
Logger: zap.NewNop(),
Path: p,
Limiter: l,
URL: loadgencfg.Config.ServerURL.String(),
Token: loadgencfg.Config.SecretToken,
APIKey: loadgencfg.Config.APIKey,
IgnoreErrors: loadgencfg.Config.IgnoreErrors,
RewriteIDs: loadgencfg.Config.RewriteIDs,
RewriteTimestamps: loadgencfg.Config.RewriteTimestamps,
Headers: loadgencfg.Config.Headers,
Protocol: protocol,
})
if err != nil {
// panicing ensures that the error is reported
// see: https://github.com/golang/go/issues/32066
panic(err)
}
return h
}