i am using go-swagger . Sentry added perormance monitoring i am looking for best pratice to add this feature in my project.
I know, go-swagger uses "net/http" but it is still a liitle bit controversial about correct way to adding. I added init sentry into configure_myapp_api.go
func InitSentry(cfg *configs.Config) {
err := sentry.Init(sentry.ClientOptions{
Dsn: cfg.SentryDsn,
Environment: fmt.Sprintf("[%s][%s]", "myapp-api-back", cfg.SentryEnvironment),
AttachStacktrace: true,
TracesSampleRate: 0.2,
SampleRate: 0.2,
EnableTracing: true,
})
if err != nil {
log.Fatalf("Sentry initialization failed: %v\n", err)
}
defer sentry.Recover()
}
Should it be just a middleware?