From 1cc3f194e449fa91c4bca28b795bc6d402238b5c Mon Sep 17 00:00:00 2001 From: valere Date: Tue, 18 Apr 2023 15:05:43 +0200 Subject: [PATCH 1/2] rust/native analytics E2E errors --- .../java/im/vector/app/core/di/ActiveSessionHolder.kt | 8 ++++++++ .../app/features/analytics/DecryptionFailureTracker.kt | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt b/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt index f3d775b39f..472d0896f9 100644 --- a/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt +++ b/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt @@ -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 = 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() { diff --git a/vector/src/main/java/im/vector/app/features/analytics/DecryptionFailureTracker.kt b/vector/src/main/java/im/vector/app/features/analytics/DecryptionFailureTracker.kt index 90a4a3213c..d596741d53 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/DecryptionFailureTracker.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/DecryptionFailureTracker.kt @@ -58,6 +58,8 @@ class DecryptionFailureTracker @Inject constructor( private val failures = mutableListOf() private val alreadyReported = mutableListOf() + 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) } } From 316666d6a49ca91d9ab5f417ff8c9bd1e12af4d6 Mon Sep 17 00:00:00 2001 From: valere Date: Thu, 20 Apr 2023 16:55:02 +0200 Subject: [PATCH 2/2] Add changelog add changelog --- changelog.d/8340.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/8340.misc diff --git a/changelog.d/8340.misc b/changelog.d/8340.misc new file mode 100644 index 0000000000..52556b5b42 --- /dev/null +++ b/changelog.d/8340.misc @@ -0,0 +1 @@ +Analytics: add crypto module to E2E events