feat(GODT-2278): properly override server_name for go.

This commit is contained in:
Romain LE JEUNE
2023-02-08 15:13:15 +01:00
parent d1f1c390f6
commit a740a8f962

View File

@ -43,6 +43,7 @@ func init() { //nolint:gochecknoinits
Release: constants.Revision, Release: constants.Revision,
BeforeSend: EnhanceSentryEvent, BeforeSend: EnhanceSentryEvent,
Transport: sentrySyncTransport, Transport: sentrySyncTransport,
ServerName: getProtectedHostname(),
}); err != nil { }); err != nil {
logrus.WithError(err).Error("Failed to initialize sentry options") logrus.WithError(err).Error("Failed to initialize sentry options")
} }
@ -63,7 +64,6 @@ type Reporter struct {
appVersion string appVersion string
identifier Identifier identifier Identifier
hostArch string hostArch string
serverName string
} }
type Identifier interface { type Identifier interface {
@ -85,7 +85,6 @@ func NewReporter(appName, appVersion string, identifier Identifier) *Reporter {
appVersion: appVersion, appVersion: appVersion,
identifier: identifier, identifier: identifier,
hostArch: getHostArch(), hostArch: getHostArch(),
serverName: getProtectedHostname(),
} }
} }
@ -137,12 +136,11 @@ func (r *Reporter) scopedReport(context map[string]interface{}, doReport func())
} }
tags := map[string]string{ tags := map[string]string{
"OS": runtime.GOOS, "OS": runtime.GOOS,
"Client": r.appName, "Client": r.appName,
"Version": r.appVersion, "Version": r.appVersion,
"UserAgent": r.identifier.GetUserAgent(), "UserAgent": r.identifier.GetUserAgent(),
"HostArch": r.hostArch, "HostArch": r.hostArch,
"server_name": r.serverName,
} }
sentry.WithScope(func(scope *sentry.Scope) { sentry.WithScope(func(scope *sentry.Scope) {