-
-
Notifications
You must be signed in to change notification settings - Fork 354
fix(feedback): Align get user with JS implementation #4901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0e42017 | 402.23 ms | 415.04 ms | 12.81 ms |
| ec2a485 | 450.84 ms | 447.49 ms | -3.35 ms |
| 1f1c420 | 403.32 ms | 411.98 ms | 8.66 ms |
| 6e8a851 | 425.59 ms | 433.51 ms | 7.92 ms |
| df5da5d | 425.55 ms | 432.96 ms | 7.41 ms |
| b4d6bde | 425.51 ms | 417.37 ms | -8.14 ms |
| 940bd65 | 466.31 ms | 458.52 ms | -7.79 ms |
| 7d3c3cb | 444.85 ms | 456.65 ms | 11.81 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0e42017 | 17.75 MiB | 20.15 MiB | 2.40 MiB |
| ec2a485 | 17.75 MiB | 20.15 MiB | 2.40 MiB |
| 1f1c420 | 17.75 MiB | 20.15 MiB | 2.40 MiB |
| 6e8a851 | 17.75 MiB | 20.15 MiB | 2.40 MiB |
| df5da5d | 17.75 MiB | 20.15 MiB | 2.40 MiB |
| b4d6bde | 17.75 MiB | 20.15 MiB | 2.40 MiB |
| 940bd65 | 17.75 MiB | 20.15 MiB | 2.40 MiB |
| 7d3c3cb | 17.75 MiB | 20.15 MiB | 2.40 MiB |
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 940bd65+dirty | 408.45 ms | 419.75 ms | 11.30 ms |
| 7d3c3cb+dirty | 395.20 ms | 413.24 ms | 18.04 ms |
| 0e42017+dirty | 387.33 ms | 399.30 ms | 11.97 ms |
| ec2a485+dirty | 397.67 ms | 390.91 ms | -6.76 ms |
| df5da5d+dirty | 415.54 ms | 456.96 ms | 41.42 ms |
| 6e8a851+dirty | 403.44 ms | 430.87 ms | 27.43 ms |
| b4d6bde+dirty | 390.51 ms | 385.60 ms | -4.91 ms |
| 1f1c420+dirty | 383.31 ms | 386.98 ms | 3.67 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 940bd65+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
| 7d3c3cb+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
| 0e42017+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
| ec2a485+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
| df5da5d+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
| 6e8a851+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
| b4d6bde+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
| 1f1c420+dirty | 7.15 MiB | 8.42 MiB | 1.26 MiB |
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| df5da5d+dirty | 1235.98 ms | 1243.41 ms | 7.43 ms |
| 6e8a851+dirty | 1227.96 ms | 1235.61 ms | 7.65 ms |
| 0e42017+dirty | 1225.89 ms | 1231.63 ms | 5.74 ms |
| 1f1c420+dirty | 1216.77 ms | 1214.48 ms | -2.29 ms |
| 940bd65+dirty | 1216.88 ms | 1225.23 ms | 8.35 ms |
| b4d6bde+dirty | 1223.22 ms | 1243.56 ms | 20.34 ms |
| 7d3c3cb+dirty | 1226.39 ms | 1227.10 ms | 0.71 ms |
| ec2a485+dirty | 1219.72 ms | 1224.66 ms | 4.94 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| df5da5d+dirty | 2.63 MiB | 3.78 MiB | 1.15 MiB |
| 6e8a851+dirty | 2.63 MiB | 3.78 MiB | 1.15 MiB |
| 0e42017+dirty | 2.63 MiB | 3.78 MiB | 1.15 MiB |
| 1f1c420+dirty | 2.63 MiB | 3.77 MiB | 1.14 MiB |
| 940bd65+dirty | 2.63 MiB | 3.78 MiB | 1.15 MiB |
| b4d6bde+dirty | 2.63 MiB | 3.77 MiB | 1.14 MiB |
| 7d3c3cb+dirty | 2.63 MiB | 3.78 MiB | 1.15 MiB |
| ec2a485+dirty | 2.63 MiB | 3.78 MiB | 1.15 MiB |
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| df5da5d+dirty | 1226.82 ms | 1234.88 ms | 8.06 ms |
| 6e8a851+dirty | 1222.57 ms | 1223.67 ms | 1.10 ms |
| 0e42017+dirty | 1235.77 ms | 1247.43 ms | 11.66 ms |
| 1f1c420+dirty | 1238.06 ms | 1234.04 ms | -4.02 ms |
| 940bd65+dirty | 1224.39 ms | 1215.57 ms | -8.82 ms |
| b4d6bde+dirty | 1218.73 ms | 1223.26 ms | 4.53 ms |
| 7d3c3cb+dirty | 1214.56 ms | 1234.53 ms | 19.97 ms |
| ec2a485+dirty | 1209.65 ms | 1229.18 ms | 19.53 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| df5da5d+dirty | 3.19 MiB | 4.35 MiB | 1.17 MiB |
| 6e8a851+dirty | 3.19 MiB | 4.35 MiB | 1.17 MiB |
| 0e42017+dirty | 3.19 MiB | 4.35 MiB | 1.16 MiB |
| 1f1c420+dirty | 3.19 MiB | 4.34 MiB | 1.16 MiB |
| 940bd65+dirty | 3.19 MiB | 4.35 MiB | 1.16 MiB |
| b4d6bde+dirty | 3.19 MiB | 4.34 MiB | 1.16 MiB |
| 7d3c3cb+dirty | 3.19 MiB | 4.35 MiB | 1.16 MiB |
| ec2a485+dirty | 3.19 MiB | 4.35 MiB | 1.17 MiB |
# Conflicts: # packages/core/src/js/feedback/FeedbackWidget.tsx
|
|
||
| private _getUser = (): User | undefined => { | ||
| const currentUser = getCurrentScope().getUser(); | ||
| if (currentUser && Object.keys(currentUser).length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any specific edge case for which && Object.keys(currentUser).length is needed?
My thinking is if there is a user set (empty, or without email and name) we should take it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @krystofwoldrich 👍
I just used the JS logic on this but I agree with you and I'll iterate on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with beaa541
An alternative would be to check just the user email or name like:
if (currentUser && (currentUser.email || currentUser.name)) {
Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>
| const currentUser = getCurrentScope().getUser(); | ||
| if (currentUser) { | ||
| return currentUser; | ||
| } | ||
| const isolationUser = getIsolationScope().getUser(); | ||
| if (isolationUser) { | ||
| return isolationUser; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i: Most people set the user by using Sentry.setUser, with that we could invert the currentScope with isolationScope so it return in most of the cases on first try.
| const currentUser = getCurrentScope().getUser(); | |
| if (currentUser) { | |
| return currentUser; | |
| } | |
| const isolationUser = getIsolationScope().getUser(); | |
| if (isolationUser) { | |
| return isolationUser; | |
| } | |
| const isolationUser = getIsolationScope().getUser(); | |
| if (isolationUser { | |
| return isolationUser; | |
| } | |
| const currentUser = getCurrentScope().getUser(); | |
| if (currentUser) { | |
| return currentUser; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion makes sense to me @lucas-zimerman and also aligns with the documentation given that we are handling user data. On the other hand any data set on the current scope should take precedence over data set on the isolation and global scope, which is the logic used in the JS feedback widget 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can skip the suggeston and talk about it on a follow up issue so the main issue doesn't get blocked for too long.
To me it sounds like, on react native context, where you'll only have one user, Sentry.SetUser should use the global scope instead of an isolation scope.
Maybe it could be a nice nit that we could change on V7 if others agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened an issue for this #4915
lucas-zimerman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
krystofwoldrich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 Thank you!
📢 Type of change
📜 Description
Align get user with JS implementation
💡 Motivation and Context
Fixes #4896
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled🔮 Next steps