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 --- flake.nix | 1 - go.mod | 1 - go.sum | 6 ------ internal/server/server.go | 28 +++------------------------- justfile | 1 - nix/gomod2nix.toml | 3 --- 6 files changed, 3 insertions(+), 37 deletions(-) diff --git a/flake.nix b/flake.nix index e912820..2ed262e 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,6 @@ modd nodePackages.vercel netlify-cli - sentry-cli ] ++ commonShellPackages; }; }; diff --git a/go.mod b/go.mod index f4a3f7a..a9faab2 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/crewjam/csp v0.0.2 github.com/deckarep/golang-set/v2 v2.6.0 github.com/fatih/structtag v1.2.0 - github.com/getsentry/sentry-go v0.27.0 github.com/otiai10/copy v1.14.0 github.com/pkg/errors v0.9.1 github.com/snabb/sitemap v1.0.4 diff --git a/go.sum b/go.sum index c94c9d3..1500ab2 100644 --- a/go.sum +++ b/go.sum @@ -40,10 +40,6 @@ github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80N github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= -github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -68,8 +64,6 @@ github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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, diff --git a/justfile b/justfile index aec4a36..5e8df3d 100755 --- a/justfile +++ b/justfile @@ -3,7 +3,6 @@ fly-system := "x86_64-linux" fly-registry := "registry.fly.io/alanpearce-eu" docker-tag := env_var_or_default("DOCKER_TAG", `date +%Y%m%d%H%M%S` + "-" + `git rev-parse --short HEAD`) -environment := "production" started-at := `date +%s` default: diff --git a/nix/gomod2nix.toml b/nix/gomod2nix.toml index f0e5e29..234e43e 100644 --- a/nix/gomod2nix.toml +++ b/nix/gomod2nix.toml @@ -59,9 +59,6 @@ schema = 3 [mod."github.com/fatih/structtag"] version = "v1.2.0" hash = "sha256-Y2pjiEmMsxfUH8LONU2/f8k1BibOHeLKJmi4uZm/SSU=" - [mod."github.com/getsentry/sentry-go"] - version = "v0.27.0" - hash = "sha256-PTkTzVNogqFA/5rc6INLY6RxK5uR1AoJFOO+pOPdE7Q=" [mod."github.com/golang/groupcache"] version = "v0.0.0-20210331224755-41bb18bfe9da" hash = "sha256-7Gs7CS9gEYZkbu5P4hqPGBpeGZWC64VDwraSKFF+VR0=" -- cgit 1.4.1