rust/native analytics E2E errors

This commit is contained in:
valere 2023-04-18 15:05:43 +02:00
parent d4d9a1068a
commit 1cc3f194e4
2 changed files with 16 additions and 1 deletions

View File

@ -22,6 +22,8 @@ import im.vector.app.core.dispatchers.CoroutineDispatchers
import im.vector.app.core.pushers.UnregisterUnifiedPushUseCase
import im.vector.app.core.services.GuardServiceStarter
import im.vector.app.core.session.ConfigureAndStartSessionUseCase
import im.vector.app.features.analytics.DecryptionFailureTracker
import im.vector.app.features.analytics.plan.Error
import im.vector.app.features.call.webrtc.WebRtcCallManager
import im.vector.app.features.crypto.keysrequest.KeyRequestHandler
import im.vector.app.features.crypto.verification.IncomingVerificationRequestHandler
@ -56,6 +58,7 @@ class ActiveSessionHolder @Inject constructor(
private val unregisterUnifiedPushUseCase: UnregisterUnifiedPushUseCase,
private val applicationCoroutineScope: CoroutineScope,
private val coroutineDispatchers: CoroutineDispatchers,
private val decryptionFailureTracker: DecryptionFailureTracker,
) {
private var activeSessionReference: AtomicReference<Session?> = AtomicReference()
@ -72,6 +75,11 @@ class ActiveSessionHolder @Inject constructor(
session.callSignalingService().addCallListener(callManager)
imageManager.onSessionStarted(session)
guardServiceStarter.start()
decryptionFailureTracker.currentModule = if (session.cryptoService().name() == "rust-sdk") {
Error.CryptoModule.Rust
} else {
Error.CryptoModule.Native
}
}
suspend fun clearActiveSession() {

View File

@ -58,6 +58,8 @@ class DecryptionFailureTracker @Inject constructor(
private val failures = mutableListOf<DecryptionFailure>()
private val alreadyReported = mutableListOf<String>()
var currentModule: Error.CryptoModule? = null
init {
start()
}
@ -137,7 +139,12 @@ class DecryptionFailureTracker @Inject constructor(
// for now we ignore events already reported even if displayed again?
.filter { alreadyReported.contains(it).not() }
.forEach { failedEventId ->
analyticsTracker.capture(Error(context = aggregation.key.first, domain = Error.Domain.E2EE, name = aggregation.key.second))
analyticsTracker.capture(Error(
context = aggregation.key.first,
domain = Error.Domain.E2EE,
name = aggregation.key.second,
cryptoModule = currentModule
))
alreadyReported.add(failedEventId)
}
}