Commit 6e0e7cd9 authored by Minh X. Nguyen's avatar Minh X. Nguyen Committed by Commit Bot

Extensions: Add Extensions.UnifiedExtensionUpdaterUpdateServiceErrors histogram.

Now that the update client can return update service error details, this
information can be used to understand more about what kind of service
errors the update service may encouter when doing update checks.

Bug: 869663
Change-Id: I10c693b05ebbe6c1f804606c4749acb0a178e7bd
Reviewed-on: https://chromium-review.googlesource.com/1180076Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarRobert Kaplow (slow) <rkaplow@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Commit-Queue: Minh Nguyen <mxnguyen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584585}
parent 9ef5a887
...@@ -41,17 +41,31 @@ void ReportUpdateCheckResult(ExtensionUpdaterUpdateResult update_result, ...@@ -41,17 +41,31 @@ void ReportUpdateCheckResult(ExtensionUpdaterUpdateResult update_result,
UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionUpdaterUpdateResults", UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionUpdaterUpdateResults",
update_result, update_result,
ExtensionUpdaterUpdateResult::UPDATE_RESULT_COUNT); ExtensionUpdaterUpdateResult::UPDATE_RESULT_COUNT);
// This UMA histogram measures update check results of the unified extension // This UMA histogram measures update check results of the unified extension
// updater. // updater.
UMA_HISTOGRAM_ENUMERATION("Extensions.UnifiedExtensionUpdaterUpdateResults", UMA_HISTOGRAM_ENUMERATION("Extensions.UnifiedExtensionUpdaterUpdateResults",
update_result, update_result,
ExtensionUpdaterUpdateResult::UPDATE_RESULT_COUNT); ExtensionUpdaterUpdateResult::UPDATE_RESULT_COUNT);
if (update_result == ExtensionUpdaterUpdateResult::UPDATE_CHECK_ERROR)
base::UmaHistogramSparse( switch (update_result) {
"Extensions.UnifiedExtensionUpdaterUpdateCheckErrors", error_code); case ExtensionUpdaterUpdateResult::UPDATE_CHECK_ERROR:
else if (update_result == ExtensionUpdaterUpdateResult::UPDATE_DOWNLOAD_ERROR) base::UmaHistogramSparse(
base::UmaHistogramSparse("Extensions.UnifiedExtensionUpdaterDownloadErrors", "Extensions.UnifiedExtensionUpdaterUpdateCheckErrors", error_code);
error_code); break;
case ExtensionUpdaterUpdateResult::UPDATE_DOWNLOAD_ERROR:
base::UmaHistogramSparse(
"Extensions.UnifiedExtensionUpdaterDownloadErrors", error_code);
break;
case ExtensionUpdaterUpdateResult::UPDATE_SERVICE_ERROR:
UMA_HISTOGRAM_ENUMERATION(
"Extensions.UnifiedExtensionUpdaterUpdateServiceErrors",
static_cast<update_client::Error>(error_code),
update_client::Error::MAX_VALUE);
break;
default:
break;
}
} }
} // namespace } // namespace
...@@ -135,65 +149,16 @@ void UpdateService::OnEvent(Events event, const std::string& extension_id) { ...@@ -135,65 +149,16 @@ void UpdateService::OnEvent(Events event, const std::string& extension_id) {
case Events::COMPONENT_UPDATE_ERROR: case Events::COMPONENT_UPDATE_ERROR:
complete_event = true; complete_event = true;
finish_delayed_installation = true; finish_delayed_installation = true;
{ HandleComponentUpdateErrorEvent(extension_id);
update_client::ErrorCategory error_category =
update_client::ErrorCategory::kNone;
update_client::CrxUpdateItem update_item;
if (update_client_->GetCrxUpdateState(extension_id, &update_item)) {
// When update_client_->GetCrxUpdateState(...) returns false, it means
// that |update_client_| can't find any information about this
// |extension_id|. It could be possible that |extension_id| was
// uninstalled when |update_client_| was checking for updates.
// (see bug http://crbug.com/869663).
error_category = update_item.error_category;
}
switch (error_category) {
case update_client::ErrorCategory::kUpdateCheck:
ReportUpdateCheckResult(
ExtensionUpdaterUpdateResult::UPDATE_CHECK_ERROR,
update_item.error_code);
break;
case update_client::ErrorCategory::kDownload:
ReportUpdateCheckResult(
ExtensionUpdaterUpdateResult::UPDATE_DOWNLOAD_ERROR,
update_item.error_code);
break;
case update_client::ErrorCategory::kUnpack:
case update_client::ErrorCategory::kInstall:
ReportUpdateCheckResult(
ExtensionUpdaterUpdateResult::UPDATE_INSTALL_ERROR, 0);
break;
case update_client::ErrorCategory::kNone:
case update_client::ErrorCategory::kService:
ReportUpdateCheckResult(
ExtensionUpdaterUpdateResult::UPDATE_SERVICE_ERROR, 0);
break;
}
}
break; break;
case Events::COMPONENT_NOT_UPDATED: case Events::COMPONENT_NOT_UPDATED:
complete_event = true; complete_event = true;
finish_delayed_installation = true; finish_delayed_installation = true;
ReportUpdateCheckResult(ExtensionUpdaterUpdateResult::NO_UPDATE, 0); ReportUpdateCheckResult(ExtensionUpdaterUpdateResult::NO_UPDATE, 0);
break; break;
case Events::COMPONENT_UPDATE_FOUND: { case Events::COMPONENT_UPDATE_FOUND:
UMA_HISTOGRAM_COUNTS_100("Extensions.ExtensionUpdaterUpdateFoundCount", HandleComponentUpdateFoundEvent(extension_id);
1);
{
update_client::CrxUpdateItem update_item;
if (update_client_->GetCrxUpdateState(extension_id, &update_item)) {
VLOG(3) << "UpdateService::OnEvent COMPONENT_UPDATE_FOUND: "
<< extension_id << " "
<< update_item.next_version.GetString();
UpdateDetails update_info(extension_id, update_item.next_version);
content::NotificationService::current()->Notify(
extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND,
content::NotificationService::AllBrowserContextsAndSources(),
content::Details<UpdateDetails>(&update_info));
}
}
break; break;
}
case Events::COMPONENT_CHECKING_FOR_UPDATES: case Events::COMPONENT_CHECKING_FOR_UPDATES:
case Events::COMPONENT_WAIT: case Events::COMPONENT_WAIT:
case Events::COMPONENT_UPDATE_READY: case Events::COMPONENT_UPDATE_READY:
...@@ -360,4 +325,55 @@ void UpdateService::RemoveUpdateClientObserver( ...@@ -360,4 +325,55 @@ void UpdateService::RemoveUpdateClientObserver(
update_client_->RemoveObserver(observer); update_client_->RemoveObserver(observer);
} }
void UpdateService::HandleComponentUpdateErrorEvent(
const std::string& extension_id) const {
update_client::ErrorCategory error_category =
update_client::ErrorCategory::kNone;
int error_code = 0;
update_client::CrxUpdateItem update_item;
if (update_client_->GetCrxUpdateState(extension_id, &update_item)) {
error_category = update_item.error_category;
error_code = update_item.error_code;
}
switch (error_category) {
case update_client::ErrorCategory::kUpdateCheck:
ReportUpdateCheckResult(ExtensionUpdaterUpdateResult::UPDATE_CHECK_ERROR,
error_code);
break;
case update_client::ErrorCategory::kDownload:
ReportUpdateCheckResult(
ExtensionUpdaterUpdateResult::UPDATE_DOWNLOAD_ERROR, error_code);
break;
case update_client::ErrorCategory::kUnpack:
case update_client::ErrorCategory::kInstall:
ReportUpdateCheckResult(
ExtensionUpdaterUpdateResult::UPDATE_INSTALL_ERROR, 0);
break;
case update_client::ErrorCategory::kNone:
case update_client::ErrorCategory::kService:
ReportUpdateCheckResult(
ExtensionUpdaterUpdateResult::UPDATE_SERVICE_ERROR, error_code);
break;
}
}
void UpdateService::HandleComponentUpdateFoundEvent(
const std::string& extension_id) const {
UMA_HISTOGRAM_COUNTS_100("Extensions.ExtensionUpdaterUpdateFoundCount", 1);
update_client::CrxUpdateItem update_item;
if (!update_client_->GetCrxUpdateState(extension_id, &update_item)) {
return;
}
VLOG(3) << "UpdateService::OnEvent COMPONENT_UPDATE_FOUND: " << extension_id
<< " " << update_item.next_version.GetString();
UpdateDetails update_info(extension_id, update_item.next_version);
content::NotificationService::current()->Notify(
extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND,
content::NotificationService::AllBrowserContextsAndSources(),
content::Details<UpdateDetails>(&update_info));
}
} // namespace extensions } // namespace extensions
...@@ -102,6 +102,8 @@ class UpdateService : public KeyedService, ...@@ -102,6 +102,8 @@ class UpdateService : public KeyedService,
void AddUpdateClientObserver(update_client::UpdateClient::Observer* observer); void AddUpdateClientObserver(update_client::UpdateClient::Observer* observer);
void RemoveUpdateClientObserver( void RemoveUpdateClientObserver(
update_client::UpdateClient::Observer* observer); update_client::UpdateClient::Observer* observer);
void HandleComponentUpdateErrorEvent(const std::string& extension_id) const;
void HandleComponentUpdateFoundEvent(const std::string& extension_id) const;
private: private:
content::BrowserContext* browser_context_; content::BrowserContext* browser_context_;
......
...@@ -30616,6 +30616,15 @@ uploading your change for review. ...@@ -30616,6 +30616,15 @@ uploading your change for review.
</summary> </summary>
</histogram> </histogram>
<histogram name="Extensions.UnifiedExtensionUpdaterUpdateServiceErrors"
enum="UpdateClientErrors">
<owner>mxnguyen@chromium.org</owner>
<summary>
The update service errors that the update service encouters during an update
check session using update client.
</summary>
</histogram>
<histogram name="Extensions.UninstallDialogAction" <histogram name="Extensions.UninstallDialogAction"
enum="ExtensionUninstallDialogAction"> enum="ExtensionUninstallDialogAction">
<owner>rdevlin.cronin@chromium.org</owner> <owner>rdevlin.cronin@chromium.org</owner>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment