Skip to content

Commit

Permalink
composer: send error log messages to sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
diaasami authored and ondrejbudai committed Feb 14, 2024
1 parent d0caac9 commit f08d1f6
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/osbuild-composer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/coreos/go-systemd/activation"
"github.com/getsentry/sentry-go"
sentrylogrus "github.com/getsentry/sentry-go/logrus"
slogger "github.com/osbuild/osbuild-composer/pkg/splunk_logger"
"github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -78,6 +79,12 @@ func main() {
if err != nil {
panic(err)
}

sentryhook := sentrylogrus.NewFromClient([]logrus.Level{logrus.PanicLevel,
logrus.FatalLevel, logrus.ErrorLevel},
sentry.CurrentHub().Client())
logrus.AddHook(sentryhook)

} else {
logrus.Warn("GLITCHTIP_DSN not configured, skipping initializing Sentry/Glitchtip")
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ github.com/getsentry/sentry-go/internal/otel/baggage
github.com/getsentry/sentry-go/internal/otel/baggage/internal/baggage
github.com/getsentry/sentry-go/internal/ratelimit
github.com/getsentry/sentry-go/internal/traceparser
github.com/getsentry/sentry-go/logrus
# github.com/ghodss/yaml v1.0.0
## explicit
github.com/ghodss/yaml
Expand Down

0 comments on commit f08d1f6

Please sign in to comment.