Skip to content

Commit

Permalink
Update Sync error pixels (#3046)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1201621708115095/1207559244852258/f

Description:
Rename count limit exceeded as object limit exceeded and add "Too Many Requests" pixels.
  • Loading branch information
ayoy authored Jul 5, 2024
1 parent dc1d84e commit 950d8ba
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
28 changes: 20 additions & 8 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,17 @@ extension Pixel {
case syncFailedToMigrate
case syncFailedToLoadAccount
case syncFailedToSetupEngine
case syncBookmarksCountLimitExceededDaily
case syncCredentialsCountLimitExceededDaily
case syncBookmarksObjectLimitExceededDaily
case syncCredentialsObjectLimitExceededDaily
case syncBookmarksRequestSizeLimitExceededDaily
case syncCredentialsRequestSizeLimitExceededDaily

case syncBookmarksTooManyRequestsDaily
case syncCredentialsTooManyRequestsDaily
case syncSettingsTooManyRequestsDaily
case syncBookmarksValidationErrorDaily
case syncCredentialsValidationErrorDaily
case syncSettingsValidationErrorDaily

case syncSentUnauthenticatedRequest
case syncMetadataCouldNotLoadDatabase
case syncBookmarksFailed
Expand Down Expand Up @@ -1250,11 +1256,17 @@ extension Pixel.Event {
case .syncFailedToMigrate: return "m_d_sync_failed_to_migrate"
case .syncFailedToLoadAccount: return "m_d_sync_failed_to_load_account"
case .syncFailedToSetupEngine: return "m_d_sync_failed_to_setup_engine"
case .syncBookmarksCountLimitExceededDaily: return "m_d_sync_bookmarks_count_limit_exceeded_daily"
case .syncCredentialsCountLimitExceededDaily: return "m_d_sync_credentials_count_limit_exceeded_daily"
case .syncBookmarksRequestSizeLimitExceededDaily: return "m_d_sync_bookmarks_request_size_limit_exceeded_daily"
case .syncCredentialsRequestSizeLimitExceededDaily: return "m_d_sync_credentials_request_size_limit_exceeded_daily"

case .syncBookmarksObjectLimitExceededDaily: return "m_sync_bookmarks_object_limit_exceeded_daily"
case .syncCredentialsObjectLimitExceededDaily: return "m_sync_credentials_object_limit_exceeded_daily"
case .syncBookmarksRequestSizeLimitExceededDaily: return "m_sync_bookmarks_request_size_limit_exceeded_daily"
case .syncCredentialsRequestSizeLimitExceededDaily: return "m_sync_credentials_request_size_limit_exceeded_daily"
case .syncBookmarksTooManyRequestsDaily: return "m_sync_bookmarks_too_many_requests_daily"
case .syncCredentialsTooManyRequestsDaily: return "m_sync_credentials_too_many_requests_daily"
case .syncSettingsTooManyRequestsDaily: return "m_sync_settings_too_many_requests_daily"
case .syncBookmarksValidationErrorDaily: return "m_sync_bookmarks_validation_error_daily"
case .syncCredentialsValidationErrorDaily: return "m_sync_credentials_validation_error_daily"
case .syncSettingsValidationErrorDaily: return "m_sync_settings_validation_error_daily"

case .syncSentUnauthenticatedRequest: return "m_d_sync_sent_unauthenticated_request"
case .syncMetadataCouldNotLoadDatabase: return "m_d_sync_metadata_could_not_load_database"
case .syncBookmarksFailed: return "m_d_sync_bookmarks_failed"
Expand Down
28 changes: 26 additions & 2 deletions Core/SyncErrorHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,12 @@ extension SyncErrorHandler {
case .settings:
break
}
DailyPixel.fire(pixel: modelType.badRequestPixel)
case .unexpectedStatusCode(401):
syncIsPaused(errorType: .invalidLoginCredentials)
case .unexpectedStatusCode(418), .unexpectedStatusCode(429):
syncIsPaused(errorType: .tooManyRequests)
DailyPixel.fire(pixel: modelType.tooManyRequestsPixel)
default:
break
}
Expand All @@ -223,11 +225,11 @@ extension SyncErrorHandler {
case .bookmarksCountLimitExceeded:
currentSyncBookmarksPausedError = errorType.rawValue
self.isSyncBookmarksPaused = true
DailyPixel.fire(pixel: .syncBookmarksCountLimitExceededDaily)
DailyPixel.fire(pixel: .syncBookmarksObjectLimitExceededDaily)
case .credentialsCountLimitExceeded:
currentSyncCredentialsPausedError = errorType.rawValue
self.isSyncCredentialsPaused = true
DailyPixel.fire(pixel: .syncCredentialsCountLimitExceededDaily)
DailyPixel.fire(pixel: .syncCredentialsObjectLimitExceededDaily)
case .bookmarksRequestSizeLimitExceeded:
currentSyncBookmarksPausedError = errorType.rawValue
self.isSyncBookmarksPaused = true
Expand Down Expand Up @@ -305,6 +307,28 @@ extension SyncErrorHandler {
.syncSettingsPatchCompressionFailed
}
}

var tooManyRequestsPixel: Pixel.Event {
switch self {
case .bookmarks:
.syncBookmarksTooManyRequestsDaily
case .credentials:
.syncCredentialsTooManyRequestsDaily
case .settings:
.syncSettingsTooManyRequestsDaily
}
}

var badRequestPixel: Pixel.Event {
switch self {
case .bookmarks:
.syncBookmarksValidationErrorDaily
case .credentials:
.syncCredentialsValidationErrorDaily
case .settings:
.syncSettingsValidationErrorDaily
}
}
}
}

Expand Down

0 comments on commit 950d8ba

Please sign in to comment.