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

Unified Diff: components/policy/core/common/cloud/device_management_service.cc

Issue 2426533002: Add UMA histogram to show how many retries we had to do to execute a DeviceManagementRequestJob. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/cloud/device_management_service.cc
diff --git a/components/policy/core/common/cloud/device_management_service.cc b/components/policy/core/common/cloud/device_management_service.cc
index c2790e8326dc27c622f4a475b7c44cd1054e5b58..bb8d2443ad095420c0944c6c44f933bc5de604be 100644
--- a/components/policy/core/common/cloud/device_management_service.cc
+++ b/components/policy/core/common/cloud/device_management_service.cc
@@ -10,6 +10,7 @@
#include "base/compiler_specific.h"
#include "base/location.h"
#include "base/macros.h"
+#include "base/metrics/histogram.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "components/data_use_measurement/core/data_use_user_data.h"
@@ -229,6 +230,22 @@ class DeviceManagementRequestJobImpl : public DeviceManagementRequestJob {
DISALLOW_COPY_AND_ASSIGN(DeviceManagementRequestJobImpl);
};
+// Used in the Enterprise.DMServerRequestSuccess histogram, shows how many
+// retries we had to do to execute the DeviceManagementRequestJob.
+enum DMServerRequestSuccess {
+ // No retries happened, the request succeeded for the first try.
+ REQUEST_NO_RETRY = 0,
+
+ // 1..kMaxRetries: number of retries
+
+ // The request failed (too many retries or non-retriable error).
+ REQUEST_FAILED = 10,
+ // The server responded with an error.
+ REQUEST_ERROR,
+
+ REQUEST_MAX
+};
+
DeviceManagementRequestJobImpl::DeviceManagementRequestJobImpl(
JobType type,
const std::string& agent_parameter,
@@ -255,6 +272,9 @@ void DeviceManagementRequestJobImpl::HandleResponse(
int response_code,
const std::string& data) {
if (status.status() != net::URLRequestStatus::SUCCESS) {
+ UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess",
+ DMServerRequestSuccess::REQUEST_FAILED,
+ DMServerRequestSuccess::REQUEST_MAX);
LOG(WARNING) << "DMServer request failed, status: " << status.status()
<< ", error: " << status.error();
em::DeviceManagementResponse dummy_response;
@@ -262,8 +282,17 @@ void DeviceManagementRequestJobImpl::HandleResponse(
return;
}
- if (response_code != kSuccess)
+ if (response_code != kSuccess) {
+ UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess",
+ DMServerRequestSuccess::REQUEST_ERROR,
+ DMServerRequestSuccess::REQUEST_MAX);
LOG(WARNING) << "DMServer sent an error response: " << response_code;
+ } else {
+ // Success with retries_count_ retries.
+ UMA_HISTOGRAM_ENUMERATION("Enterprise.DMServerRequestSuccess",
+ retries_count_,
+ DMServerRequestSuccess::REQUEST_MAX);
+ }
switch (response_code) {
case kSuccess: {
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698