diff options
author | mtomasz <mtomasz@chromium.org> | 2015-07-01 00:50:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-01 07:51:31 +0000 |
commit | 66993bab523887333ed3284cac9e1978d889bd5a (patch) | |
tree | 89069bda4e33e6e79fc770dfd81552a73b03f490 /google_apis/drive | |
parent | a8b71d5f4edfd472a42a6adff689ed81f3f64d41 (diff) | |
download | chromium_src-66993bab523887333ed3284cac9e1978d889bd5a.zip chromium_src-66993bab523887333ed3284cac9e1978d889bd5a.tar.gz chromium_src-66993bab523887333ed3284cac9e1978d889bd5a.tar.bz2 |
Add UMA for the size backoff in FilesListRequestRunner.
This CL adds UMA so we can say how much the backoff is used.
TEST=Checked chrome://histograms.
BUG=433716
Review URL: https://codereview.chromium.org/1220023002
Cr-Commit-Position: refs/heads/master@{#336991}
Diffstat (limited to 'google_apis/drive')
-rw-r--r-- | google_apis/drive/drive_api_error_codes.h | 20 | ||||
-rw-r--r-- | google_apis/drive/files_list_request_runner.cc | 7 |
2 files changed, 18 insertions, 9 deletions
diff --git a/google_apis/drive/drive_api_error_codes.h b/google_apis/drive/drive_api_error_codes.h index 10aa901..62ab938 100644 --- a/google_apis/drive/drive_api_error_codes.h +++ b/google_apis/drive/drive_api_error_codes.h @@ -9,7 +9,8 @@ namespace google_apis { -// HTTP errors that can be returned by Drive API service. +// HTTP errors that can be returned by Drive API service. Keep all the values +// positive, as they are used for UMA histograms. enum DriveApiErrorCode { HTTP_SUCCESS = 200, HTTP_CREATED = 201, @@ -29,14 +30,15 @@ enum DriveApiErrorCode { HTTP_NOT_IMPLEMENTED = 501, HTTP_BAD_GATEWAY = 502, HTTP_SERVICE_UNAVAILABLE = 503, - DRIVE_PARSE_ERROR = -100, - DRIVE_FILE_ERROR = -101, - DRIVE_CANCELLED = -102, - DRIVE_OTHER_ERROR = -103, - DRIVE_NO_CONNECTION = -104, - DRIVE_NOT_READY = -105, - DRIVE_NO_SPACE = -106, - DRIVE_RESPONSE_TOO_LARGE = -107 + DRIVE_PARSE_ERROR = 1000, + DRIVE_FILE_ERROR = 1001, + DRIVE_CANCELLED = 1002, + DRIVE_OTHER_ERROR = 1003, + DRIVE_NO_CONNECTION = 1004, + DRIVE_NOT_READY = 1005, + DRIVE_NO_SPACE = 1006, + DRIVE_RESPONSE_TOO_LARGE = 1007 + // If modified, update the enum mapping in histograms.xml. }; // Returns a string representation of DriveApiErrorCode. diff --git a/google_apis/drive/files_list_request_runner.cc b/google_apis/drive/files_list_request_runner.cc index 8bf50be..c3588b7 100644 --- a/google_apis/drive/files_list_request_runner.cc +++ b/google_apis/drive/files_list_request_runner.cc @@ -5,6 +5,8 @@ #include "google_apis/drive/files_list_request_runner.h" #include "base/bind.h" +#include "base/metrics/histogram_macros.h" +#include "base/metrics/sparse_histogram.h" #include "google_apis/drive/drive_api_error_codes.h" #include "google_apis/drive/drive_api_requests.h" #include "google_apis/drive/request_sender.h" @@ -27,6 +29,8 @@ CancelCallback FilesListRequestRunner::CreateAndStartWithSizeBackoff( const std::string& q, const std::string& fields, const FileListCallback& callback) { + UMA_HISTOGRAM_COUNTS_1000("Drive.FilesListRequestRunner.MaxResults", + max_results); base::Closure* const cancel_callback = new base::Closure; drive::FilesListRequest* const request = new drive::FilesListRequest( request_sender_, url_generator_, @@ -61,6 +65,9 @@ void FilesListRequestRunner::OnCompleted(int max_results, if (!request_completed_callback_for_testing_.is_null()) request_completed_callback_for_testing_.Run(); + UMA_HISTOGRAM_SPARSE_SLOWLY( + "Drive.FilesListRequestRunner.ApiErrorCode", error); + if (error == google_apis::DRIVE_RESPONSE_TOO_LARGE && max_results > 1) { CreateAndStartWithSizeBackoff(max_results / 2, q, fields, callback); return; |