diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index 225e1a0662..4c9d909115 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -506,6 +506,7 @@ extension Pixel { // MARK: debug pixels case dbCrashDetected + case dbCrashDetectedDaily case crashOnCrashHandlersSetUp case dbMigrationError @@ -1378,6 +1379,7 @@ extension Pixel.Event { // MARK: debug pixels case .dbCrashDetected: return "m_d_crash" + case .dbCrashDetectedDaily: return "m_d_crash_daily" case .crashOnCrashHandlersSetUp: return "m_d_crash_on_handlers_setup" case .dbMigrationError: return "m_d_dbme" case .dbRemovalError: return "m_d_dbre" diff --git a/DuckDuckGo/AppDelegate.swift b/DuckDuckGo/AppDelegate.swift index eebeceda69..75296ae8ea 100644 --- a/DuckDuckGo/AppDelegate.swift +++ b/DuckDuckGo/AppDelegate.swift @@ -182,6 +182,16 @@ import os.log crashCollection.startAttachingCrashLogMessages { pixelParameters, payloads, sendReport in pixelParameters.forEach { params in Pixel.fire(pixel: .dbCrashDetected, withAdditionalParameters: params, includedParameters: []) + + // Each crash comes with an `appVersion` parameter representing the version that the crash occurred on. + // This is to disambiguate the situation where a crash occurs, but isn't sent until the next update. + // If for some reason the parameter can't be found, fall back to the current version. + if let crashAppVersion = params[PixelParameters.appVersion] { + let dailyParameters = [PixelParameters.appVersion: crashAppVersion] + DailyPixel.fireDaily(.dbCrashDetectedDaily, withAdditionalParameters: dailyParameters) + } else { + DailyPixel.fireDaily(.dbCrashDetectedDaily) + } } // Async dispatch because rootViewController may otherwise be nil here