-
Notifications
You must be signed in to change notification settings - Fork 759
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
Track decryption failures #4856
Conversation
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, just need a small cleanup.
throw MXCryptoError.Base( | ||
MXCryptoError.ErrorType.UNKNOWN_MESSAGE_INDEX, | ||
throwable.olmException.message ?: "", | ||
throwable.olmException.message) |
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.
Nit: in this case we could use hard-coded "UNKNOWN_MESSAGE_INDEX" since this is the value of throwable.olmException.message
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.
Udpated, I did put null in detailedReason; not sure what could be put here
private fun addDecryptionFailure(failure: DecryptionFailure) { | ||
// de duplicate | ||
synchronized(failures) { | ||
if (failures.indexOfFirst { it.failedEventId == failure.failedEventId } == -1) { |
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.
Nit: use none
instead of indexOfFirst
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.
done
} | ||
|
||
private fun checkFailures() { | ||
val now = System.currentTimeMillis() |
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.
Please inject Clock
in the constructor
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.
added
@@ -122,6 +124,10 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me | |||
Timber.v("Type ${event.root.getClearType()} not handled") | |||
defaultItemFactory.create(params) | |||
} | |||
}.also { | |||
if (it != null && event.isEncrypted()) { | |||
decryptionFailureTracker.e2eEventDisplayedInTimeline(event.roomId, event.eventId, event.root.mCryptoError) |
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.
Maybe just pass the TimelineEvent instead of 3 members of the TimelineEvent to simplify the signature of this method?
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.
done
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
data class DecryptionFailure( |
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.
Could be private I think
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.
done
e7c5ed8
to
b275546
Compare
*/ | ||
@Singleton | ||
class DecryptionFailureTracker @Inject constructor( | ||
private val vectorAnalytics: VectorAnalytics, |
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.
Note to myself: change to inject the new interface AnalyticsTracker from #4734
MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID -> Error.Name.OlmKeysNotSentError | ||
MXCryptoError.ErrorType.OLM -> { | ||
Error.Name.OlmUnspecifiedError | ||
} |
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.
Just a small remark: why a different formatting here?
Fixes #4719
Track and report failure to decrypt errors