Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
| 7 // | 7 // |
| 8 // OVERVIEW | 8 // OVERVIEW |
| 9 // | 9 // |
| 10 // A MetricsService instance is typically created at application startup. It is | 10 // A MetricsService instance is typically created at application startup. It is |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1019 // Log a histogram to track response success vs. failure rates. | 1019 // Log a histogram to track response success vs. failure rates. |
| 1020 UMA_HISTOGRAM_ENUMERATION("UMA.UploadResponseStatus.Protobuf", | 1020 UMA_HISTOGRAM_ENUMERATION("UMA.UploadResponseStatus.Protobuf", |
| 1021 ResponseCodeToStatus(response_code), | 1021 ResponseCodeToStatus(response_code), |
| 1022 NUM_RESPONSE_STATUSES); | 1022 NUM_RESPONSE_STATUSES); |
| 1023 | 1023 |
| 1024 bool upload_succeeded = response_code == 200; | 1024 bool upload_succeeded = response_code == 200; |
| 1025 | 1025 |
| 1026 // Provide boolean for error recovery (allow us to ignore response_code). | 1026 // Provide boolean for error recovery (allow us to ignore response_code). |
| 1027 bool discard_log = false; | 1027 bool discard_log = false; |
| 1028 const size_t log_size = log_manager_.staged_log().length(); | 1028 const size_t log_size = log_manager_.staged_log().length(); |
| 1029 if (!upload_succeeded && log_size > kUploadLogAvoidRetransmitSize) { | 1029 if (upload_succeeded) { |
| 1030 UMA_HISTOGRAM_COUNTS_10000("UMA.LogSize", log_size / 1024); | |
|
Ilya Sherman
2014/08/30 01:23:23
Hmm, why not record this for all logs when sending
Alexei Svitkine (slow)
2014/09/02 14:50:37
I want to use this histogram to capture how much d
| |
| 1031 } else if (log_size > kUploadLogAvoidRetransmitSize) { | |
| 1030 UMA_HISTOGRAM_COUNTS("UMA.Large Rejected Log was Discarded", | 1032 UMA_HISTOGRAM_COUNTS("UMA.Large Rejected Log was Discarded", |
| 1031 static_cast<int>(log_size)); | 1033 static_cast<int>(log_size)); |
| 1032 discard_log = true; | 1034 discard_log = true; |
| 1033 } else if (response_code == 400) { | 1035 } else if (response_code == 400) { |
| 1034 // Bad syntax. Retransmission won't work. | 1036 // Bad syntax. Retransmission won't work. |
| 1035 discard_log = true; | 1037 discard_log = true; |
| 1036 } | 1038 } |
| 1037 | 1039 |
| 1038 if (upload_succeeded || discard_log) { | 1040 if (upload_succeeded || discard_log) { |
| 1039 log_manager_.DiscardStagedLog(); | 1041 log_manager_.DiscardStagedLog(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1186 local_state_->SetBoolean(path, value); | 1188 local_state_->SetBoolean(path, value); |
| 1187 RecordCurrentState(local_state_); | 1189 RecordCurrentState(local_state_); |
| 1188 } | 1190 } |
| 1189 | 1191 |
| 1190 void MetricsService::RecordCurrentState(PrefService* pref) { | 1192 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1191 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, | 1193 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, |
| 1192 base::Time::Now().ToTimeT()); | 1194 base::Time::Now().ToTimeT()); |
| 1193 } | 1195 } |
| 1194 | 1196 |
| 1195 } // namespace metrics | 1197 } // namespace metrics |
| OLD | NEW |