diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 08:04:38 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 08:04:38 +0000 |
commit | 0eb34feeee9e42f38fd78b261a60de4466a033b8 (patch) | |
tree | 95f72e20e1b54a25e8093d7cf19e6dbf8312c0ec /chrome/browser/metrics | |
parent | d4a749b4e6b30a76e51cb53cc68204f42635cef1 (diff) | |
download | chromium_src-0eb34feeee9e42f38fd78b261a60de4466a033b8.zip chromium_src-0eb34feeee9e42f38fd78b261a60de4466a033b8.tar.gz chromium_src-0eb34feeee9e42f38fd78b261a60de4466a033b8.tar.bz2 |
Discard corrupt old logs in UMA upload
Detect logs that are unacceptable to the server, and don't
retransmit them (it won't help to send them again).
bug= 1505736
r=huanr,evanm
Review URL: http://codereview.chromium.org/18444
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8361 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index e830659..f89b2a7 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -218,7 +218,7 @@ static const int kUnsentLogDelay = 15; // 15 seconds // sending the next log. If the channel is busy, such as when there is a // failure during an attempt to transmit a previous log, then a log may wait // (and continue to accrue now log entries) for a much greater period of time. -static const int kMinSecondsPerLog = 90; // 20 * 60; // Twenty minutes. +static const int kMinSecondsPerLog = 20 * 60; // Twenty minutes. // When we don't succeed at transmitting a log to a server, we progressively // wait longer and longer before sending the next log. This backoff process @@ -1151,20 +1151,25 @@ void MetricsService::OnURLFetchComplete(const URLFetcher* source, LOG(INFO) << "METRICS RESPONSE CODE: " << response_code << " status=" << StatusToString(status); - // TODO(petersont): Refactor or remove the following so that we don't have to - // fake a valid response code. + // Provide boolean for error recovery (allow us to ignore response_code). + boolean discard_log = false; + if (response_code != 200 && pending_log_text_.length() > kUploadLogAvoidRetransmitSize) { UMA_HISTOGRAM_COUNTS(L"UMA.Large Rejected Log was Discarded", static_cast<int>(pending_log_text_.length())); - response_code = 200; // Simulate transmission so we will discard log. + discard_log = true; + } else if (response_code == 400) { + // Bad syntax. Retransmission won't work. + UMA_HISTOGRAM_COUNTS(L"UMA.Unacceptable_Log_Discarded", state_); + discard_log = true; } - if (response_code != 200) { + if (response_code != 200 && !discard_log) { LOG(INFO) << "METRICS: transmission attempt returned a failure code: " << response_code << ". Verify network connectivity"; HandleBadResponseCode(); - } else { // Success. + } else { // Successful receipt (or we are discarding log). LOG(INFO) << "METRICS RESPONSE DATA: " << data; switch (state_) { case INITIAL_LOG_READY: |