Chromium Code Reviews| Index: components/ntp_snippets/ntp_snippets_fetcher.cc |
| diff --git a/components/ntp_snippets/ntp_snippets_fetcher.cc b/components/ntp_snippets/ntp_snippets_fetcher.cc |
| index 7fe3d94b0e54b22c86e052357ff1bf1e2a1f0f48..007d337e65a2a2b0aa8f6187d3b85b5b60d10bf0 100644 |
| --- a/components/ntp_snippets/ntp_snippets_fetcher.cc |
| +++ b/components/ntp_snippets/ntp_snippets_fetcher.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| +#include "base/metrics/sparse_histogram.h" |
| #include "base/path_service.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/strings/string_util.h" |
| @@ -120,12 +121,23 @@ void NTPSnippetsFetcher::OnURLFetchComplete(const URLFetcher* source) { |
| std::string message; |
| const URLRequestStatus& status = source->GetStatus(); |
| + |
| if (!status.is_success()) { |
| + // Error codes are guaranteed to be negative so let's negate to use positive |
| + // buckets. |
| + UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.Snippets.FailedRequestErrorCode", |
| + -status.error()); |
| + |
| message = base::StringPrintf(kStatusMessageURLRequestErrorFormat, |
| status.error()); |
| - } else if (source->GetResponseCode() != net::HTTP_OK) { |
| - message = base::StringPrintf(kStatusMessageHTTPErrorFormat, |
| - source->GetResponseCode()); |
| + } else { |
| + UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.Snippets.FetchResponseCode", |
|
Alexei Svitkine (slow)
2016/05/02 17:15:14
You can actually log these two together, see Combi
|
| + source->GetResponseCode()); |
| + |
| + if (source->GetResponseCode() != net::HTTP_OK) { |
| + message = base::StringPrintf(kStatusMessageHTTPErrorFormat, |
| + source->GetResponseCode()); |
| + } |
| } |
| std::string response; |