composer: glitchtip integration

This commit is contained in:
Diaa Sami 2024-01-18 20:22:36 +01:00 committed by Ondřej Budai
parent 95b4979d88
commit c9c51613a4
63 changed files with 8857 additions and 220 deletions

View file

@ -21,6 +21,7 @@ type ComposerConfigFile struct {
SplunkHost string `env:"SPLUNK_HEC_HOST"`
SplunkPort string `env:"SPLUNK_HEC_PORT"`
SplunkToken string `env:"SPLUNK_HEC_TOKEN"`
GlitchTipDSN string `env:"GLITCHTIP_DSN"`
}
type KojiAPIConfig struct {

View file

@ -6,6 +6,7 @@ import (
"os"
"github.com/coreos/go-systemd/activation"
"github.com/getsentry/sentry-go"
slogger "github.com/osbuild/osbuild-composer/pkg/splunk_logger"
"github.com/sirupsen/logrus"
)
@ -70,6 +71,17 @@ func main() {
logrus.AddHook(hook)
}
if config.GlitchTipDSN != "" {
err = sentry.Init(sentry.ClientOptions{
Dsn: config.GlitchTipDSN,
})
if err != nil {
panic(err)
}
} else {
logrus.Warn("GLITCHTIP_DSN not configured, skipping initializing Sentry/Glitchtip")
}
stateDir, ok := os.LookupEnv("STATE_DIRECTORY")
if !ok {
logrus.Fatal("STATE_DIRECTORY is not set. Is the service file missing StateDirectory=?")