@@ -101,18 +101,26 @@ func Bootstrap(templates embed.FS, diggerController controllers.DiggerController
101101 logging .Init ()
102102 cfg := config .DiggerConfig
103103
104- if err := sentry .Init (sentry.ClientOptions {
105- Dsn : os .Getenv ("SENTRY_DSN" ),
106- EnableTracing : true ,
107- // Set TracesSampleRate to 1.0 to capture 100%
108- // of transactions for performance monitoring.
109- // We recommend adjusting this value in production,
110- TracesSampleRate : 0.1 ,
111- Release : "api@" + Version ,
112- Debug : true ,
113- DebugWriter : utils .NewSentrySlogWriter (slog .Default ().WithGroup ("sentry" )),
114- }); err != nil {
115- slog .Error ("Sentry initialization failed" , "error" , err )
104+ sentryDsn := os .Getenv ("SENTRY_DSN" )
105+ if sentryDsn != "" {
106+ if err := sentry .Init (sentry.ClientOptions {
107+ Dsn : sentryDsn ,
108+ EnableTracing : true ,
109+ AttachStacktrace : true ,
110+ // Set TracesSampleRate to 1.0 to capture 100%
111+ // of transactions for performance monitoring.
112+ // We recommend adjusting this value in production,
113+ TracesSampleRate : 0.1 ,
114+ Release : "api@" + Version ,
115+ Debug : true ,
116+ DebugWriter : utils .NewSentrySlogWriter (slog .Default ().WithGroup ("sentry" )),
117+ }); err != nil {
118+ slog .Error ("Sentry initialization failed" , "error" , err )
119+ } else {
120+ slog .Info ("Sentry initialized successfully" , "dsn_configured" , true )
121+ }
122+ } else {
123+ slog .Warn ("SENTRY_DSN not configured, Sentry error tracking disabled" )
116124 }
117125
118126 //database migrations
0 commit comments