We rely quite heavily on k6 extensions in our current setup. One thing we’d like to be able to do is integrate with sentry
to pick up on any exceptions our extensions run into. Our first attempt at doing this was to wrap the CLI:
func main() {
err := sentry.Init(sentry.ClientOptions{
Dsn: "SomeDSN",
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
defer sentry.Flush(2 * time.Second)
k6cmd.Execute()
However, this doesn’t work since sentry doesn’t quite support logrus and, even if it did, I’m not positive sentry would be able to pick up exceptions since k6 code uses a custom logger threaded throughout.
One approach I was considering was creating a k6 extension that can somehow grab the existing logrus logger and add new hooks. Is that possible?
Aside:
I do think moving logging to its own extension would help and I’m reasonably interested in helping; however, I’m trying to find a workaround in the meantime.