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

Unified Diff: components/ntp_snippets/ntp_snippets_fetcher.cc

Issue 1937063002: [NTP Snippets] Add metric for fetch error cases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@record_article_fetch_errors_0
Patch Set: Adopted FetchHttpResponseOrErrorCode. Created 4 years, 8 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 | components/ntp_snippets/ntp_snippets_fetcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3dd50354dd411f89befa333246e436ff2a8b0f39 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,6 +121,11 @@ void NTPSnippetsFetcher::OnURLFetchComplete(const URLFetcher* source) {
std::string message;
const URLRequestStatus& status = source->GetStatus();
+
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "NewTabPage.Snippets.FetchHttpResponseOrErrorCode",
+ status.is_success() ? source->GetResponseCode() : status.error());
+
if (!status.is_success()) {
message = base::StringPrintf(kStatusMessageURLRequestErrorFormat,
status.error());
« no previous file with comments | « no previous file | components/ntp_snippets/ntp_snippets_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698