28 lines
532 B
Go
28 lines
532 B
Go
package internal
|
|
|
|
import (
|
|
"github.com/Kichiyaki/appmode"
|
|
"github.com/getsentry/sentry-go"
|
|
"github.com/pkg/errors"
|
|
"os"
|
|
)
|
|
|
|
const (
|
|
sentryAppName = "zdam-egzamin-zawodowy-backend"
|
|
)
|
|
|
|
func InitSentry(version string) error {
|
|
err := sentry.Init(sentry.ClientOptions{
|
|
Dsn: os.Getenv("SENTRY_DSN"),
|
|
Environment: appmode.Get(),
|
|
Release: sentryAppName + "@" + version,
|
|
Debug: false,
|
|
TracesSampleRate: 0.3,
|
|
})
|
|
if err != nil {
|
|
return errors.Wrap(err, "sentry.Init")
|
|
}
|
|
|
|
return nil
|
|
}
|