mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
GODT-1376: Add first userID to sentry scope.
This commit is contained in:
@ -189,6 +189,8 @@ func New( // nolint[funlen]
|
||||
|
||||
cm := pmapi.New(cfg)
|
||||
|
||||
sentryReporter.SetClientFromManager(cm)
|
||||
|
||||
cm.AddConnectionObserver(pmapi.NewConnectionObserver(
|
||||
func() { listener.Emit(events.InternetOffEvent, "") },
|
||||
func() { listener.Emit(events.InternetOnEvent, "") },
|
||||
|
||||
@ -20,11 +20,13 @@ package sentry
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/internal/constants"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@ -42,7 +44,13 @@ func init() { //nolint[noinit, gochecknoinits]
|
||||
|
||||
sentry.ConfigureScope(func(scope *sentry.Scope) {
|
||||
scope.SetFingerprint([]string{"{{ default }}"})
|
||||
scope.SetTag("UserID", "not-defined")
|
||||
})
|
||||
|
||||
sentry.Logger = log.New(
|
||||
logrus.WithField("pkg", "sentry-go").WriterLevel(logrus.WarnLevel),
|
||||
"", 0,
|
||||
)
|
||||
}
|
||||
|
||||
type Reporter struct {
|
||||
@ -111,7 +119,6 @@ func (r *Reporter) scopedReport(context map[string]interface{}, doReport func())
|
||||
"Client": r.appName,
|
||||
"Version": r.appVersion,
|
||||
"UserAgent": r.userAgent.String(),
|
||||
"UserID": "",
|
||||
"HostArch": r.hostArch,
|
||||
}
|
||||
|
||||
@ -182,3 +189,6 @@ func isFunctionFilteredOut(function string) bool {
|
||||
func Flush(maxWaiTime time.Duration) {
|
||||
sentry.Flush(maxWaiTime)
|
||||
}
|
||||
|
||||
func (r *Reporter) SetClientFromManager(cm pmapi.Manager) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user