MESSENGER-4821 add dimension for decryption error tracking

This commit is contained in:
JanNiklas Grabowski
2023-10-11 15:07:07 +02:00
parent 7312ad09ad
commit 77705a42ae
5 changed files with 19 additions and 12 deletions

View File

@@ -77,7 +77,7 @@ NSString *const kDecryptionFailureTrackerAnalyticsCategory = @"e2e.failure";
return self;
}
- (void)reportUnableToDecryptErrorForEvent:(MXEvent *)event withRoomState:(MXRoomState *)roomState myUser:(NSString *)userId
- (void)reportUnableToDecryptErrorForEvent:(MXEvent *)event withRoomState:(MXRoomState *)roomState myUser:(NSString *)userId roomDeviceCount:(NSInteger)deviceCount
{
if (reportedFailures[event.eventId] || [trackedEvents containsObject:event.eventId])
{
@@ -117,7 +117,8 @@ NSString *const kDecryptionFailureTrackerAnalyticsCategory = @"e2e.failure";
reportedFailures[event.eventId] = [[DecryptionFailure alloc] initWithFailedEventId:failedEventId
reason:reason
context:context
errorCode:event.decryptionError.code];
errorCode:event.decryptionError.code
deviceCount:deviceCount];
}
- (void)dispatch
@@ -158,8 +159,8 @@ NSString *const kDecryptionFailureTrackerAnalyticsCategory = @"e2e.failure";
NSMutableDictionary<NSNumber*, NSNumber*> *failuresCounts = [NSMutableDictionary dictionary];
for (DecryptionFailure *failure in failuresToTrack)
{
if ( failure.reason == DecryptionFailureReasonUnspecified) {
[BWIAnalytics.sharedTracker trackE2EEError:failure.errorCode];
if (failure.reason == DecryptionFailureReasonUnspecified) {
[BWIAnalytics.sharedTracker trackE2EEErrorWithDimension:failure.errorCode deviceCount:[BWIAnalyticsHelper dimensionForDeviceCount: failure.deviceCount]];
} else {
failuresCounts[@(failure.reason)] = @(failuresCounts[@(failure.reason)].unsignedIntegerValue + 1);
}