-
Notifications
You must be signed in to change notification settings - Fork 245
Closed
Labels
BugIssue typeIssue type
Description
I have this code:
func SetUserProfile(ctx context.Context, profile *models.UserProfile) error {
span := sentry.StartSpan(ctx, "method", sentry.WithDescription("SetUserProfile"))
defer span.Finish()
ctx = span.Context()
err := setProfile(profile)
if err != nil {
return err
}
sentry.ConfigureScope(func(scope *sentry.Scope) {
scope.SetUser(sentry.User{
ID: profile.ID,
Email: profile.Email,
Username: profile.Username,
Name: profile.FullName,
})
})
return nil
}But it doesn't set user when I call sentry.StartSpan in it:
func run() {
tr := sentry.StartTransaction(context.Background(), "Command: run")
defer tr.Finish()
ctx := tr.Context()
// ...
SetUserProfile(ctx, profile)
// ...
if err != nil {
sentry.CaptureError(err) // no user reported
}
}After debugging it looks like it happens because StartSpan pushes new scope and SetUser is called on that not at the root scope.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugIssue typeIssue type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
No status