From 51746cbec1b3a301298f2b8fbfb201010d6adb52 Mon Sep 17 00:00:00 2001 From: im-adithya Date: Mon, 15 Jul 2024 18:54:46 +0530 Subject: [PATCH] feat: configure sentry --- cmd/server/main.go | 9 +++++++++ go.mod | 1 + go.sum | 2 ++ 3 files changed, 12 insertions(+) diff --git a/cmd/server/main.go b/cmd/server/main.go index 92fc8fe..fbc05a2 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -9,6 +9,7 @@ import ( "http-nostr/internal/nostr" echologrus "github.com/davrux/echo-logrus/v4" + "github.com/getsentry/sentry-go" "github.com/labstack/echo/v4" "github.com/sirupsen/logrus" ddEcho "gopkg.in/DataDog/dd-trace-go.v1/contrib/labstack/echo.v4" @@ -23,6 +24,14 @@ func main() { logrus.Fatalf("Failed to initialize service: %v", err) } + if svc.Cfg.SentryDSN != "" { + if err = sentry.Init(sentry.ClientOptions{ + Dsn: svc.Cfg.SentryDSN, + }); err != nil { + logrus.Error(err) + } + } + echologrus.Logger = svc.Logger e := echo.New() if svc.Cfg.DatadogAgentUrl != "" { diff --git a/go.mod b/go.mod index f069c7e..3894211 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( require ( github.com/DataDog/go-sqllexer v0.0.11 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/getsentry/sentry-go v0.28.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect diff --git a/go.sum b/go.sum index eb5261e..f748d82 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/ebitengine/purego v0.7.1 h1:6/55d26lG3o9VCZX8lping+bZcmShseiqlh2bnUDiPA= github.com/ebitengine/purego v0.7.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= +github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k= +github.com/getsentry/sentry-go v0.28.1/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg= github.com/go-gormigrate/gormigrate/v2 v2.1.2 h1:F/d1hpHbRAvKezziV2CC5KUE82cVe9zTgHSBoOOZ4CY= github.com/go-gormigrate/gormigrate/v2 v2.1.2/go.mod h1:9nHVX6z3FCMCQPA7PThGcA55t22yKQfK/Dnsf5i7hUo= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=