@@ -38,6 +38,7 @@ private data class DecryptionFailure(
3838 val failedEventId : String ,
3939 val error : MXCryptoError .ErrorType
4040)
41+ private typealias DetailedErrorName = Pair <String , Error .Name >
4142
4243private const val GRACE_PERIOD_MILLIS = 4_000
4344private const val CHECK_INTERVAL = 2_000L
@@ -112,7 +113,7 @@ class DecryptionFailureTracker @Inject constructor(
112113
113114 private fun checkFailures () {
114115 val now = clock.epochMillis()
115- val aggregatedErrors: Map <Error . Name , List <String >>
116+ val aggregatedErrors: Map <DetailedErrorName , List <String >>
116117 synchronized(failures) {
117118 val toReport = mutableListOf<DecryptionFailure >()
118119 failures.removeAll { failure ->
@@ -136,20 +137,21 @@ class DecryptionFailureTracker @Inject constructor(
136137 // for now we ignore events already reported even if displayed again?
137138 .filter { alreadyReported.contains(it).not () }
138139 .forEach { failedEventId ->
139- analyticsTracker.capture(Error (failedEventId , Error .Domain .E2EE , aggregation.key))
140+ analyticsTracker.capture(Error (aggregation.key.first , Error .Domain .E2EE , aggregation.key.second ))
140141 alreadyReported.add(failedEventId)
141142 }
142143 }
143144 }
144145
145- private fun MXCryptoError.ErrorType.toAnalyticsErrorName (): Error . Name {
146- return when ( this ) {
147- MXCryptoError . ErrorType . UNKNOWN_INBOUND_SESSION_ID -> Error . Name . OlmKeysNotSentError
148- MXCryptoError .ErrorType .OLM -> {
149- Error .Name .OlmUnspecifiedError
150- }
151- MXCryptoError .ErrorType .UNKNOWN_MESSAGE_INDEX -> Error .Name .OlmIndexError
152- else -> Error .Name .UnknownError
146+ private fun MXCryptoError.ErrorType.toAnalyticsErrorName (): DetailedErrorName {
147+ val detailed = " $name | mxc_crypto_error_type "
148+ val errorName = when ( this ) {
149+ MXCryptoError .ErrorType .UNKNOWN_INBOUND_SESSION_ID ,
150+ MXCryptoError . ErrorType . KEYS_WITHHELD -> Error .Name .OlmKeysNotSentError
151+ MXCryptoError . ErrorType . OLM -> Error . Name . OlmUnspecifiedError
152+ MXCryptoError .ErrorType .UNKNOWN_MESSAGE_INDEX -> Error .Name .OlmIndexError
153+ else -> Error .Name .UnknownError
153154 }
155+ return DetailedErrorName (detailed, errorName)
154156 }
155157}
0 commit comments