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

Side by Side Diff: components/safe_browsing_db/v4_update_protocol_manager.cc

Issue 2029753002: Add an entry in histograms.xml for SafeBrowsing.V4UpdateHttpResponseOrErrorCode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "components/safe_browsing_db/v4_update_protocol_manager.h" 5 #include "components/safe_browsing_db/v4_update_protocol_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/metrics/sparse_histogram.h"
12 #include "base/rand_util.h" 13 #include "base/rand_util.h"
13 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
14 #include "components/safe_browsing_db/safebrowsing.pb.h" 15 #include "components/safe_browsing_db/safebrowsing.pb.h"
15 #include "net/base/load_flags.h" 16 #include "net/base/load_flags.h"
16 #include "net/http/http_response_headers.h" 17 #include "net/http/http_response_headers.h"
17 #include "net/http/http_status_code.h" 18 #include "net/http/http_status_code.h"
18 #include "net/url_request/url_fetcher.h" 19 #include "net/url_request/url_fetcher.h"
19 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
20 21
21 using base::Time; 22 using base::Time;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // The callback must call ScheduleNextUpdate() at the end to resume 322 // The callback must call ScheduleNextUpdate() at the end to resume
322 // downloading updates. 323 // downloading updates.
323 update_callback_.Run(list_update_responses); 324 update_callback_.Run(list_update_responses);
324 } else { 325 } else {
325 DVLOG(1) << "SafeBrowsing GetEncodedUpdates request for: " 326 DVLOG(1) << "SafeBrowsing GetEncodedUpdates request for: "
326 << source->GetURL() << " failed with error: " << status.error() 327 << source->GetURL() << " failed with error: " << status.error()
327 << " and response code: " << response_code; 328 << " and response code: " << response_code;
328 329
329 if (status.status() == net::URLRequestStatus::FAILED) { 330 if (status.status() == net::URLRequestStatus::FAILED) {
330 RecordUpdateResult(V4OperationResult::NETWORK_ERROR); 331 RecordUpdateResult(V4OperationResult::NETWORK_ERROR);
332 // Negate the error value since it is negative, see:
333 // net/base/net_error_list.h
334 UMA_HISTOGRAM_SPARSE_SLOWLY("SafeBrowsing.V4UpdateNetworkError",
Nathan Parker 2016/06/02 20:56:31 How about recording both the network error or stat
vakh (use Gerrit instead) 2016/06/02 21:43:27 Done.
335 -status.error());
331 } else { 336 } else {
332 RecordUpdateResult(V4OperationResult::HTTP_ERROR); 337 RecordUpdateResult(V4OperationResult::HTTP_ERROR);
333 } 338 }
334 // TODO(vakh): Figure out whether it is just a network error vs backoff vs 339 // TODO(vakh): Figure out whether it is just a network error vs backoff vs
335 // another condition and RecordUpdateResult more accurately. 340 // another condition and RecordUpdateResult more accurately.
336 341
337 request_.reset(); 342 request_.reset();
338 ScheduleNextUpdateWithBackoff(true); 343 ScheduleNextUpdateWithBackoff(true);
339 } 344 }
340 } 345 }
341 346
342 GURL V4UpdateProtocolManager::GetUpdateUrl( 347 GURL V4UpdateProtocolManager::GetUpdateUrl(
343 const std::string& req_base64) const { 348 const std::string& req_base64) const {
344 GURL url = V4ProtocolManagerUtil::GetRequestUrl(req_base64, "encodedUpdates", 349 GURL url = V4ProtocolManagerUtil::GetRequestUrl(req_base64, "encodedUpdates",
345 config_); 350 config_);
346 DVLOG(1) << "V4UpdateProtocolManager::GetUpdateUrl: " 351 DVLOG(1) << "V4UpdateProtocolManager::GetUpdateUrl: "
347 << "url: " << url; 352 << "url: " << url;
348 return url; 353 return url;
349 } 354 }
350 355
351 } // namespace safe_browsing 356 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698