Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: components/offline_pages/background/request_coordinator_event_logger.cc

Issue 2324493005: [Offline Pages] Adds event logs for requests dropped due to number of start or complete attempts. (Closed)
Patch Set: Addresses dimich feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/background/request_coordinator_event_logger.cc
diff --git a/components/offline_pages/background/request_coordinator_event_logger.cc b/components/offline_pages/background/request_coordinator_event_logger.cc
index 08702920a734dcb463a7c53df1d9a3cf38145bbb..51b3bbcff1452bbce37e831faee5d0734ab95ecc 100644
--- a/components/offline_pages/background/request_coordinator_event_logger.cc
+++ b/components/offline_pages/background/request_coordinator_event_logger.cc
@@ -28,8 +28,35 @@ static std::string OfflinerRequestStatusToString(
case Offliner::FOREGROUND_CANCELED:
return "FOREGROUND_CANCELED";
default:
- DCHECK(false);
- return "";
+ NOTREACHED();
+ return std::to_string(static_cast<int>(request_status));
+ }
+}
+
+static std::string BackgroundSavePageResultToString(
+ RequestNotifier::BackgroundSavePageResult result) {
+ switch (result) {
+ case RequestNotifier::BackgroundSavePageResult::SUCCESS:
+ return "SUCCESS";
+ case RequestNotifier::BackgroundSavePageResult::PRERENDER_FAILURE:
+ return "PRERENDER_FAILURE";
+ case RequestNotifier::BackgroundSavePageResult::PRERENDER_CANCELED:
+ return "PRERENDER_CANCELED";
+ case RequestNotifier::BackgroundSavePageResult::FOREGROUND_CANCELED:
+ return "FOREGROUND_CANCELED";
+ case RequestNotifier::BackgroundSavePageResult::SAVE_FAILED:
+ return "SAVE_FAILED";
+ case RequestNotifier::BackgroundSavePageResult::EXPIRED:
+ return "EXPIRED";
+ case RequestNotifier::BackgroundSavePageResult::RETRY_COUNT_EXCEEDED:
+ return "RETRY_COUNT_EXCEEDED";
+ case RequestNotifier::BackgroundSavePageResult::START_COUNT_EXCEEDED:
+ return "START_COUNT_EXCEEDED";
+ case RequestNotifier::BackgroundSavePageResult::REMOVED:
+ return "REMOVED";
+ default:
+ NOTREACHED();
+ return std::to_string(static_cast<int>(result));
}
}
@@ -43,28 +70,36 @@ static std::string UpdateRequestResultToString(
case RequestQueue::UpdateRequestResult::REQUEST_DOES_NOT_EXIST:
return "REQUEST_DOES_NOT_EXIST";
default:
- DCHECK(false);
- return "";
+ NOTREACHED();
+ return std::to_string(static_cast<int>(result));
}
}
} // namespace
-void RequestCoordinatorEventLogger::RecordSavePageRequestUpdated(
+void RequestCoordinatorEventLogger::RecordOfflinerResult(
const std::string& name_space,
Offliner::RequestStatus new_status,
- int64_t id) {
- RecordActivity("Save page request for ID: " + std::to_string(id) +
- " and namespace: " + name_space +
- " has been updated with status " +
+ int64_t request_id) {
+ RecordActivity("Background save attempt for " + name_space + ":" +
+ std::to_string(request_id) + " - " +
OfflinerRequestStatusToString(new_status));
}
+void RequestCoordinatorEventLogger::RecordDroppedSavePageRequest(
+ const std::string& name_space,
+ RequestNotifier::BackgroundSavePageResult result,
+ int64_t request_id) {
+ RecordActivity("Background save request removed " + name_space + ":" +
+ std::to_string(request_id) + " - " +
+ BackgroundSavePageResultToString(result));
+}
+
void RequestCoordinatorEventLogger::RecordUpdateRequestFailed(
const std::string& name_space,
RequestQueue::UpdateRequestResult result) {
- RecordActivity("Updating queued request for namespace: " + name_space +
- " failed with result: " + UpdateRequestResultToString(result));
+ RecordActivity("Updating queued request for " + name_space + " failed - " +
+ UpdateRequestResultToString(result));
}
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698