sync3.Setup may log to sentry

This commit is contained in:
David Robertson 2023-04-05 18:40:23 +01:00
parent c4cc35fcfc
commit 03823bd3ff
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD

View File

@ -115,14 +115,10 @@ func main() {
panic(err)
}
}
h2, h3 := syncv3.Setup(args[EnvServer], args[EnvDB], args[EnvSecret], syncv3.Opts{
Debug: args[EnvDebug] == "1",
AddPrometheusMetrics: args[EnvPrometheus] != "",
})
// Initialise sentry. We do this in a separate block to the sentry code below,
// because we want to configure logging before starting the pollers—they may want to
// log to sentry themselves.
// because we want to configure logging before the call to syncv3.Setup---which may
// want to log to sentry itself.
if args[EnvSentryDsn] != "" {
fmt.Printf("Configuring Sentry reporter...\n")
err := sentry.Init(sentry.ClientOptions{
@ -136,11 +132,17 @@ func main() {
}
}
h2, h3 := syncv3.Setup(args[EnvServer], args[EnvDB], args[EnvSecret], syncv3.Opts{
Debug: args[EnvDebug] == "1",
AddPrometheusMetrics: args[EnvPrometheus] != "",
})
go h2.StartV2Pollers()
if args[EnvJaeger] != "" {
h3 = otelhttp.NewHandler(h3, "Sync")
}
// Install the Sentry middleware, if configured.
if args[EnvSentryDsn] != "" {
sentryHandler := sentryhttp.New(sentryhttp.Options{
Repanic: true,