From e89fbd7ef3e418629ea2533cf4fa9707fe51950f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 11 Jun 2024 09:22:32 +0200 Subject: server: remove sentry --- internal/server/server.go | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'internal') diff --git a/internal/server/server.go b/internal/server/server.go index 61d5790..31db347 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -6,7 +6,6 @@ import ( "net" "net/http" "net/url" - "os" "slices" "time" @@ -14,8 +13,6 @@ import ( "website/internal/log" "website/internal/website" - "github.com/getsentry/sentry-go" - sentryhttp "github.com/getsentry/sentry-go/http" "github.com/pkg/errors" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" @@ -72,26 +69,9 @@ func New(runtimeConfig *Config) (*Server, error) { listenAddress := net.JoinHostPort(runtimeConfig.ListenAddress, runtimeConfig.Port) - env := "development" - if runtimeConfig.Production { - env = "production" - } else { + if !runtimeConfig.Production { applyDevModeOverrides(config, listenAddress) } - err = sentry.Init(sentry.ClientOptions{ - EnableTracing: true, - TracesSampleRate: 1.0, - Dsn: os.Getenv("SENTRY_DSN"), - Release: CommitSHA, - Environment: env, - }) - if err != nil { - return nil, errors.WithMessage(err, "could not set up sentry") - } - defer sentry.Flush(2 * time.Second) - sentryHandler := sentryhttp.New(sentryhttp.Options{ - Repanic: true, - }) top := http.NewServeMux() mux, err := website.NewMux(config, runtimeConfig.Root) @@ -117,10 +97,8 @@ func New(runtimeConfig *Config) (*Server, error) { Addr: listenAddress, ReadHeaderTimeout: 1 * time.Minute, Handler: http.MaxBytesHandler(h2c.NewHandler( - sentryHandler.Handle( - serverHeaderHandler( - wrapHandlerWithLogging(top), - ), + serverHeaderHandler( + wrapHandlerWithLogging(top), ), &http2.Server{ IdleTimeout: 15 * time.Minute, -- cgit 1.4.1