mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Merge pull request #6047 from vector-im/andy/6046_uisi_context
Log decryption error details as context in AnalyticsEvent
This commit is contained in:
commit
31842809af
4 changed files with 13 additions and 13 deletions
|
@ -261,12 +261,10 @@ extension Analytics {
|
|||
/// Track an E2EE error that occurred
|
||||
/// - Parameters:
|
||||
/// - reason: The error that occurred.
|
||||
/// - count: The number of times that error occurred.
|
||||
func trackE2EEError(_ reason: DecryptionFailureReason, count: Int) {
|
||||
for _ in 0..<count {
|
||||
let event = AnalyticsEvent.Error(context: nil, domain: .E2EE, name: reason.errorName)
|
||||
capture(event: event)
|
||||
}
|
||||
/// - context: Additional context of the error that occured
|
||||
func trackE2EEError(_ reason: DecryptionFailureReason, context: String) {
|
||||
let event = AnalyticsEvent.Error(context: context, domain: .E2EE, name: reason.errorName)
|
||||
capture(event: event)
|
||||
}
|
||||
|
||||
/// Track when a user becomes unauthenticated without pressing the `sign out` button.
|
||||
|
|
|
@ -45,9 +45,12 @@ import AnalyticsEvents
|
|||
let ts: TimeInterval = Date().timeIntervalSince1970
|
||||
/// Decryption failure reason.
|
||||
let reason: DecryptionFailureReason
|
||||
/// Additional context of failure
|
||||
let context: String
|
||||
|
||||
init(failedEventId: String, reason: DecryptionFailureReason) {
|
||||
init(failedEventId: String, reason: DecryptionFailureReason, context: String) {
|
||||
self.failedEventId = failedEventId
|
||||
self.reason = reason
|
||||
self.context = context
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,8 +115,10 @@ NSString *const kDecryptionFailureTrackerAnalyticsCategory = @"e2e.failure";
|
|||
break;
|
||||
}
|
||||
|
||||
NSString *context = [NSString stringWithFormat:@"code: %ld, description: %@", event.decryptionError.code, event.decryptionError.localizedDescription];
|
||||
reportedFailures[event.eventId] = [[DecryptionFailure alloc] initWithFailedEventId:failedEventId
|
||||
reason:reason];
|
||||
reason:reason
|
||||
context:context];
|
||||
}
|
||||
|
||||
- (void)dispatch
|
||||
|
@ -158,14 +160,10 @@ NSString *const kDecryptionFailureTrackerAnalyticsCategory = @"e2e.failure";
|
|||
for (DecryptionFailure *failure in failuresToTrack)
|
||||
{
|
||||
failuresCounts[@(failure.reason)] = @(failuresCounts[@(failure.reason)].unsignedIntegerValue + 1);
|
||||
[self.delegate trackE2EEError:failure.reason context:failure.context];
|
||||
}
|
||||
|
||||
MXLogDebug(@"[DecryptionFailureTracker] trackFailures: %@", failuresCounts);
|
||||
|
||||
for (NSNumber *reason in failuresCounts)
|
||||
{
|
||||
[self.delegate trackE2EEError:reason.integerValue count:failuresCounts[reason].integerValue];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
1
changelog.d/6046_uisi_context
Normal file
1
changelog.d/6046_uisi_context
Normal file
|
@ -0,0 +1 @@
|
|||
Analytics: Log decryption error details as context in AnalyticsEvent
|
Loading…
Reference in a new issue