mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:17:32 +00:00
feat: sentry integration (#1944)
* initial sentry variables and secrets * feat: sentry monitoring * fix typo * feat(sentry version): sentry capability * fix(sentry include): included sentry import 4 zitadel * usage flag for sentry * improve sentry flag * merge main * fix sentry config * add sentry dsn to secret env vars * fix test * log sentry start * add sentry grpc interceptor and recover * add sentry http interceptor to asset api * fix interceptor order * try improve sentry recover * fix i18n interception * panic Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -3,8 +3,12 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/caos/logging"
|
||||
"github.com/getsentry/sentry-go"
|
||||
|
||||
admin_es "github.com/caos/zitadel/internal/admin/repository/eventsourcing"
|
||||
"github.com/caos/zitadel/internal/api"
|
||||
@@ -89,6 +93,24 @@ const (
|
||||
)
|
||||
|
||||
func main() {
|
||||
enableSentry, _ := strconv.ParseBool(os.Getenv("SENTRY_USAGE"))
|
||||
if enableSentry {
|
||||
err := sentry.Init(sentry.ClientOptions{})
|
||||
if err != nil {
|
||||
logging.Log("MAIN-Gnzjw").WithError(err).Fatal("sentry init failed")
|
||||
}
|
||||
sentry.CaptureMessage("sentry started")
|
||||
logging.Log("MAIN-adgf3").Info("sentry started")
|
||||
defer func() {
|
||||
err := recover()
|
||||
|
||||
if err != nil {
|
||||
sentry.CurrentHub().Recover(err)
|
||||
sentry.Flush(2 * time.Second)
|
||||
panic(err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
flag.Var(configPaths, "config-files", "paths to the config files")
|
||||
flag.Var(setupPaths, "setup-files", "paths to the setup files")
|
||||
flag.Parse()
|
||||
|
Reference in New Issue
Block a user