forked from Silverfish/proton-bridge
feat(GODT-2356): unify sentry release description and add more context to it.
This commit is contained in:
@ -26,6 +26,7 @@ import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/constants"
|
||||
"github.com/ProtonMail/proton-bridge/v3/pkg/restarter"
|
||||
"github.com/getsentry/sentry-go"
|
||||
@ -37,14 +38,23 @@ var skippedFunctions = []string{} //nolint:gochecknoglobals
|
||||
func init() { //nolint:gochecknoinits
|
||||
sentrySyncTransport := sentry.NewHTTPSyncTransport()
|
||||
sentrySyncTransport.Timeout = time.Second * 3
|
||||
appVersion := constants.Version
|
||||
version, _ := semver.NewVersion(appVersion)
|
||||
if version != nil {
|
||||
appVersion = version.Original()
|
||||
}
|
||||
|
||||
if err := sentry.Init(sentry.ClientOptions{
|
||||
Dsn: constants.DSNSentry,
|
||||
Release: constants.Revision,
|
||||
BeforeSend: EnhanceSentryEvent,
|
||||
Transport: sentrySyncTransport,
|
||||
ServerName: getProtectedHostname(),
|
||||
}); err != nil {
|
||||
options := sentry.ClientOptions{
|
||||
Dsn: constants.DSNSentry,
|
||||
Release: constants.AppVersion(appVersion),
|
||||
BeforeSend: EnhanceSentryEvent,
|
||||
Transport: sentrySyncTransport,
|
||||
ServerName: getProtectedHostname(),
|
||||
Environment: constants.BuildEnv,
|
||||
MaxBreadcrumbs: 50,
|
||||
}
|
||||
|
||||
if err := sentry.Init(options); err != nil {
|
||||
logrus.WithError(err).Error("Failed to initialize sentry options")
|
||||
}
|
||||
|
||||
@ -79,10 +89,10 @@ func getProtectedHostname() string {
|
||||
}
|
||||
|
||||
// NewReporter creates new sentry reporter with appName and appVersion to report.
|
||||
func NewReporter(appName, appVersion string, identifier Identifier) *Reporter {
|
||||
func NewReporter(appName string, identifier Identifier) *Reporter {
|
||||
return &Reporter{
|
||||
appName: appName,
|
||||
appVersion: appVersion,
|
||||
appVersion: constants.Revision,
|
||||
identifier: identifier,
|
||||
hostArch: getHostArch(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user