-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add Sentry User Data #12155
Add Sentry User Data #12155
Conversation
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
You can test the changes on this Pull Request by downloading the APK here. |
f5873f5
to
2b57574
Compare
2b57574
to
e08a479
Compare
"User shouldn't be able to open a trashed post in an editor " + | ||
"without publishing rights." | ||
) | ||
AppLog.e(T.EDITOR, "User shouldn't be able to open a trashed post in an editor " + |
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.
IMHO if we're concerned about this, we should either crash if we're in an invalid state, OR we could just do the right thing, but for now we have the log.
|
||
Sentry.setTag("version", BuildConfig.VERSION_NAME) | ||
|
||
this.accountStore.account.apply { |
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.
This doesn't deal with user account transitions. I thought about moving it to beforeSend
, but the issue there is that it's called when Sentry starts up, and I'm not sure if the accountStore
has the user data at that point, so it sort of becomes a hidden dependency.
As noted in the PR description, the Tracks version of this code is a bit more resilient against this sort of issue, so the next step will be tackling that migration.
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.
Account transitions can be handled in a different way, but I am not sure if I understand why using beforeSend
would be an issue. Since beforeSend
is a callback, it should be called just before sending the error. Also, since AccountStore
is a argument passed in the constructor it should be ready to use at any point in this class. Am I missing something?
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.
Chatted about this separately – because FluxC still reads from the DB on initialization, this should always be correct internally.
Changed in 7941de4
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.
@jkmassel Looks good. I left some minor suggestions/questions. Let me know what you think about them.
I've also tested the changes and verified the user info showed up in https://sentry.io/share/issue/27e9f284baff4569a93b0161f6459a5f/.
* @param[tag] An optional [AppLog] tag | ||
*/ | ||
@JvmOverloads | ||
fun logException(tr: Throwable, tag: AppLog.T? = null) = this.log(tr.toString(), tag) |
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.
Can we use throwable
instead of tr
for the parameter name? Named arguments are pretty common in Kotlin and I don't think tr
immediately means throwable
. This applies to reportException
method as well.
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.
For sure – fixed in c54bc21
Sentry.removeExtra("tag") | ||
Sentry.removeTag("tag") |
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 assume we remove these so it doesn't affect future events. I think this might not be super clear to everyone else, so should we add a comment on top of them to explain this? If we do that, can we do it for reportException
as well?
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.
Also fixed in c54bc21
a34c5b7
to
c54bc21
Compare
5ef3875
to
946bb9f
Compare
Fix extra import Lint fix Fix user ID
Fix style Fix tests Fix test lint issues
This ensures we’re always sending the most relevant data
946bb9f
to
5fc737d
Compare
# Conflicts: # WordPress/src/main/java/org/wordpress/android/modules/AppComponent.java
Adds WordPress.com account userID, username, and email address to crash logs.
To test:
require(false)
to a Kotlin file where you can trigger it (I'd suggestPagesActivity.kt
)return true
to the top ofCrashLogging.shouldSendEvents
to ensure events are sent to Sentry regardless of environment.Next Steps:
PR submission checklist:
RELEASE-NOTES.txt
if necessary.