Remove some unused Net.* and DomainReliability.* histograms.

Bug: 782083, 782080, 775334, 755429, 753204
Bug: 753200, 745187, 719792, 689320, 656857
Bug: 784721
Change-Id: I5e1c231d1a286891d61349454b1dc6c13cfda295
Reviewed-on: https://chromium-review.googlesource.com/766955
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516361}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 1c225dc..5f208b9 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -779,8 +779,6 @@
     "net/quota_policy_channel_id_store.h",
     "net/referrer.cc",
     "net/referrer.h",
-    "net/request_source_bandwidth_histograms.cc",
-    "net/request_source_bandwidth_histograms.h",
     "net/safe_search_util.cc",
     "net/safe_search_util.h",
     "net/service_providers_win.cc",
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 08d27405..fd97798 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -29,7 +29,6 @@
 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
 #include "chrome/browser/net/chrome_extensions_network_delegate.h"
-#include "chrome/browser/net/request_source_bandwidth_histograms.h"
 #include "chrome/browser/profiles/profile_manager.h"
 #include "chrome/browser/task_manager/task_manager_interface.h"
 #include "chrome/common/features.h"
@@ -417,7 +416,6 @@
   extensions_delegate_->OnCompleted(request, started, net_error);
   if (domain_reliability_monitor_)
     domain_reliability_monitor_->OnCompleted(request, started);
-  RecordRequestSourceBandwidth(request, started);
   extensions_delegate_->ForwardProxyErrors(request, net_error);
   extensions_delegate_->ForwardDoneRequestStatus(request);
 }
diff --git a/chrome/browser/net/request_source_bandwidth_histograms.cc b/chrome/browser/net/request_source_bandwidth_histograms.cc
deleted file mode 100644
index bdcdc82..0000000
--- a/chrome/browser/net/request_source_bandwidth_histograms.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/net/request_source_bandwidth_histograms.h"
-
-#include <stdint.h>
-
-#include "base/metrics/histogram_macros.h"
-#include "content/public/browser/resource_request_info.h"
-#include "content/public/common/process_type.h"
-#include "net/url_request/url_request.h"
-
-namespace {
-
-enum Bucket {
-  BUCKET_UNKNOWN,
-  BUCKET_RENDERER,
-  BUCKET_BROWSER,
-  BUCKET_MAX,
-};
-
-bool ShouldHistogramRequest(const net::URLRequest* request, bool started) {
-  return started &&
-         !request->was_cached() &&
-         request->url().SchemeIsHTTPOrHTTPS();
-}
-
-Bucket GetBucketForRequest(const net::URLRequest* request) {
-  const content::ResourceRequestInfo* info =
-      content::ResourceRequestInfo::ForRequest(request);
-  if (!info)
-    return BUCKET_BROWSER;
-  else if (info->GetProcessType() == content::PROCESS_TYPE_RENDERER)
-    return BUCKET_RENDERER;
-  else
-    return BUCKET_UNKNOWN;
-}
-
-// Histogram response sizes in kilobytes, from 1 KB to 4 GB.
-#define UMA_HISTOGRAM_RESPONSE_KB(bucket, sample) \
-    UMA_HISTOGRAM_CUSTOM_COUNTS("Net.ResponseSizeByProcess." bucket, sample, \
-                                1, 4 * 1024 * 1024, 100)
-
-void LogRequest(Bucket bucket, int64_t bytes) {
-  int64_t kilobytes = bytes / 1024;
-  switch (bucket) {
-    case BUCKET_UNKNOWN:
-      UMA_HISTOGRAM_RESPONSE_KB("Unknown", kilobytes);
-      break;
-    case BUCKET_RENDERER:
-      UMA_HISTOGRAM_RESPONSE_KB("Renderer", kilobytes);
-      break;
-    case BUCKET_BROWSER:
-      UMA_HISTOGRAM_RESPONSE_KB("Browser", kilobytes);
-      break;
-    default:
-      NOTREACHED();
-  }
-}
-
-}  // namespace
-
-void RecordRequestSourceBandwidth(const net::URLRequest* request,
-                                  bool started) {
-  if (ShouldHistogramRequest(request, started))
-    LogRequest(GetBucketForRequest(request), request->GetTotalReceivedBytes());
-}
diff --git a/chrome/browser/net/request_source_bandwidth_histograms.h b/chrome/browser/net/request_source_bandwidth_histograms.h
deleted file mode 100644
index 88555b9..0000000
--- a/chrome/browser/net/request_source_bandwidth_histograms.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_NET_REQUEST_SOURCE_BANDWIDTH_HISTOGRAMS_H_
-#define CHROME_BROWSER_NET_REQUEST_SOURCE_BANDWIDTH_HISTOGRAMS_H_
-
-namespace net {
-class URLRequest;
-}  // namespace net
-
-// Records the bandwidth (currently just response size) made by |request| in a
-// histogram chosen based on the source of the request (currently browser,
-// renderer, or other process).
-void RecordRequestSourceBandwidth(const net::URLRequest* request,
-                                  bool started);
-
-#endif  // CHROME_BROWSER_NET_REQUEST_SOURCE_BANDWIDTH_HISTOGRAMS_H_
diff --git a/components/domain_reliability/context.cc b/components/domain_reliability/context.cc
index 3754f29..a68bf85d 100644
--- a/components/domain_reliability/context.cc
+++ b/components/domain_reliability/context.cc
@@ -26,12 +26,6 @@
 
 namespace domain_reliability {
 
-namespace {
-void LogOnBeaconDidEvictHistogram(bool evicted) {
-  UMA_HISTOGRAM_BOOLEAN("DomainReliability.OnBeaconDidEvict", evicted);
-}
-}  // namespace
-
 // static
 const int DomainReliabilityContext::kMaxUploadDepthToSchedule = 1;
 
@@ -69,34 +63,16 @@
   ClearBeacons();
 }
 
-bool DomainReliabilityContext::OnBeacon(
+void DomainReliabilityContext::OnBeacon(
     std::unique_ptr<DomainReliabilityBeacon> beacon) {
   bool success = (beacon->status == "ok");
   double sample_rate = beacon->details.quic_port_migration_detected
                            ? 1.0
                            : config().GetSampleRate(success);
-  bool should_report = base::RandDouble() < sample_rate;
-  UMA_HISTOGRAM_BOOLEAN("DomainReliability.BeaconReported", should_report);
-  if (!should_report) {
-    // If the beacon isn't queued to be reported, it definitely cannot evict
-    // an older beacon. (This histogram is also logged below based on whether
-    // an older beacon was actually evicted.)
-    LogOnBeaconDidEvictHistogram(false);
-    return false;
-  }
+  if (base::RandDouble() >= sample_rate)
+    return;
   beacon->sample_rate = sample_rate;
 
-  UMA_HISTOGRAM_SPARSE_SLOWLY("DomainReliability.ReportedBeaconError",
-                              -beacon->chrome_error);
-  if (!beacon->server_ip.empty()) {
-    UMA_HISTOGRAM_SPARSE_SLOWLY(
-        "DomainReliability.ReportedBeaconError_HasServerIP",
-        -beacon->chrome_error);
-  }
-  UMA_HISTOGRAM_COUNTS_100("DomainReliability.ReportedBeaconUploadDepth",
-                           beacon->upload_depth);
-  // TODO(juliatuttle): Histogram HTTP response code?
-
   // Allow beacons about reports, but don't schedule an upload for more than
   // one layer of recursion, to avoid infinite report loops.
   if (beacon->upload_depth <= kMaxUploadDepthToSchedule)
@@ -105,17 +81,6 @@
   bool should_evict = beacons_.size() > kMaxQueuedBeacons;
   if (should_evict)
     RemoveOldestBeacon();
-
-  LogOnBeaconDidEvictHistogram(should_evict);
-
-  base::TimeTicks now = base::TimeTicks::Now();
-  if (last_queued_beacon_time_ != base::TimeTicks()) {
-    UMA_HISTOGRAM_LONG_TIMES("DomainReliability.BeaconInterval",
-                             now - last_queued_beacon_time_);
-  }
-  last_queued_beacon_time_ = now;
-
-  return true;
 }
 
 void DomainReliabilityContext::ClearBeacons() {
@@ -198,13 +163,6 @@
       base::Bind(
           &DomainReliabilityContext::OnUploadComplete,
           weak_factory_.GetWeakPtr()));
-
-  UMA_HISTOGRAM_SPARSE_SLOWLY("DomainReliability.UploadCollectorIndex",
-                              static_cast<int>(collector_index));
-  if (!last_upload_time_.is_null()) {
-    UMA_HISTOGRAM_LONG_TIMES("DomainReliability.UploadInterval",
-                             upload_time_ - last_upload_time_);
-  }
 }
 
 void DomainReliabilityContext::OnUploadComplete(
@@ -223,8 +181,6 @@
   DCHECK(!upload_time_.is_null());
   UMA_HISTOGRAM_MEDIUM_TIMES("DomainReliability.UploadDuration",
                              now - upload_time_);
-  UMA_HISTOGRAM_LONG_TIMES("DomainReliability.UploadCollectorRetryDelay",
-                           scheduler_.last_collector_retry_delay());
   last_upload_time_ = upload_time_;
   upload_time_ = base::TimeTicks();
 }
diff --git a/components/domain_reliability/context.h b/components/domain_reliability/context.h
index d44c2f7..5038c531 100644
--- a/components/domain_reliability/context.h
+++ b/components/domain_reliability/context.h
@@ -65,10 +65,7 @@
   // Notifies the context of a beacon on its domain(s); may or may not save the
   // actual beacon to be uploaded, depending on the sample rates in the config,
   // but will increment one of the request counters in any case.
-  //
-  // Returns |true| if the beacon was queued or |false| if it was discarded,
-  // for metrics purposes.
-  bool OnBeacon(std::unique_ptr<DomainReliabilityBeacon> beacon);
+  void OnBeacon(std::unique_ptr<DomainReliabilityBeacon> beacon);
 
   // Called to clear browsing data, since beacons are like browsing history.
   void ClearBeacons();
@@ -134,8 +131,6 @@
   const base::TimeTicks* last_network_change_time_;
   const UploadAllowedCallback& upload_allowed_callback_;
 
-  base::TimeTicks last_queued_beacon_time_;
-
   base::WeakPtrFactory<DomainReliabilityContext> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext);
diff --git a/components/domain_reliability/context_manager.cc b/components/domain_reliability/context_manager.cc
index 81811c9..e0f6a8e 100644
--- a/components/domain_reliability/context_manager.cc
+++ b/components/domain_reliability/context_manager.cc
@@ -26,16 +26,7 @@
   if (!context)
     return;
 
-  bool queued = context->OnBeacon(std::move(beacon));
-  if (!queued)
-    return;
-
-  base::TimeTicks now = base::TimeTicks::Now();
-  if (!last_routed_beacon_time_.is_null()) {
-    UMA_HISTOGRAM_LONG_TIMES("DomainReliability.BeaconIntervalGlobal",
-                             now - last_routed_beacon_time_);
-  }
-  last_routed_beacon_time_ = now;
+  context->OnBeacon(std::move(beacon));
 }
 
 void DomainReliabilityContextManager::SetConfig(
@@ -57,8 +48,6 @@
     // needlessly; make sure the config has actually changed before recreating
     // the context.
     bool config_same = contexts_[key]->config().Equals(*config);
-    UMA_HISTOGRAM_BOOLEAN("DomainReliability.SetConfigRecreatedContext",
-                          !config_same);
     if (!config_same) {
       DVLOG(1) << "Ignoring unchanged NEL header for existing origin "
                << origin.spec() << ".";
diff --git a/components/domain_reliability/context_manager.h b/components/domain_reliability/context_manager.h
index c9b1d93a..c4a6679 100644
--- a/components/domain_reliability/context_manager.h
+++ b/components/domain_reliability/context_manager.h
@@ -73,8 +73,6 @@
   // context manager knows they are allowed to set a config again later.
   std::unordered_set<std::string> removed_contexts_;
 
-  base::TimeTicks last_routed_beacon_time_;
-
   DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContextManager);
 };
 
diff --git a/components/domain_reliability/scheduler.cc b/components/domain_reliability/scheduler.cc
index f598c94..5c473de 100644
--- a/components/domain_reliability/scheduler.cc
+++ b/components/domain_reliability/scheduler.cc
@@ -144,7 +144,6 @@
   backoff->InformOfRequest(result.is_success());
   if (result.is_retry_after())
     backoff->SetCustomReleaseTime(time_->NowTicks() + result.retry_after);
-  last_collector_retry_delay_ = backoff->GetTimeUntilRelease();
 
   if (!result.is_success()) {
     // Restore upload_pending_ and first_beacon_time_ to pre-upload state,
diff --git a/components/domain_reliability/scheduler.h b/components/domain_reliability/scheduler.h
index cf86a2d..7c26960d 100644
--- a/components/domain_reliability/scheduler.h
+++ b/components/domain_reliability/scheduler.h
@@ -83,13 +83,6 @@
   // uploaded.
   base::TimeTicks first_beacon_time() const { return first_beacon_time_; }
 
-  // Gets the time until the next upload attempt on the last collector used.
-  // This will be 0 if the upload was a success; it does not take into account
-  // minimum_upload_delay and maximum_upload_delay.
-  base::TimeDelta last_collector_retry_delay() const {
-    return last_collector_retry_delay_;
-  }
-
  private:
   void MaybeScheduleUpload();
 
@@ -127,10 +120,6 @@
   // first_beacon_time_ saved during uploads.  Restored if upload fails.
   base::TimeTicks old_first_beacon_time_;
 
-  // Time until the next upload attempt on the last collector used. (Saved for
-  // histograms in Context.)
-  base::TimeDelta last_collector_retry_delay_;
-
   // Extra bits to return in GetWebUIData.
   base::TimeTicks scheduled_min_time_;
   base::TimeTicks scheduled_max_time_;
diff --git a/components/domain_reliability/uploader.cc b/components/domain_reliability/uploader.cc
index a9ed70b..a4cc7de4 100644
--- a/components/domain_reliability/uploader.cc
+++ b/components/domain_reliability/uploader.cc
@@ -130,13 +130,6 @@
     fetcher->Start();
 
     uploads_[fetcher] = {std::move(owned_fetcher), callback};
-
-    base::TimeTicks now = base::TimeTicks::Now();
-    if (!last_upload_start_time_.is_null()) {
-      UMA_HISTOGRAM_LONG_TIMES("DomainReliability.UploadIntervalGlobal",
-                               now - last_upload_start_time_);
-    }
-    last_upload_start_time_ = now;
   }
 
   void SetDiscardUploads(bool discard_uploads) override {
@@ -204,7 +197,6 @@
            std::pair<std::unique_ptr<net::URLFetcher>, UploadCallback>>
       uploads_;
   bool discard_uploads_;
-  base::TimeTicks last_upload_start_time_;
   bool shutdown_;
   int discarded_upload_count_;
 };
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 32caf1a3..eb56e97 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -15981,6 +15981,9 @@
 </histogram>
 
 <histogram name="DomainReliability.BeaconInterval" units="ms">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     The time between successive Domain Reliability beacons being queued in the
@@ -15989,6 +15992,9 @@
 </histogram>
 
 <histogram name="DomainReliability.BeaconIntervalGlobal" units="ms">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     The time between successive Domain Reliability beacons being queued across
@@ -15997,6 +16003,9 @@
 </histogram>
 
 <histogram name="DomainReliability.BeaconReported" enum="BooleanReported">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     Whether a beacon added to a Domain Reliability context was saved to be
@@ -16005,6 +16014,9 @@
 </histogram>
 
 <histogram name="DomainReliability.OnBeaconDidEvict" enum="BooleanDidEvict">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     Whether adding a beacon to a Domain Reliability context caused it to evict
@@ -16013,6 +16025,9 @@
 </histogram>
 
 <histogram name="DomainReliability.ReportedBeaconError" enum="NetErrorCodes">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     The Chrome error code included in a beacon saved to be uploaded to the
@@ -16022,6 +16037,9 @@
 
 <histogram name="DomainReliability.ReportedBeaconError_HasServerIP"
     enum="NetErrorCodes">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     The Chrome error code included in a beacon with a non-empty server_ip field
@@ -16030,6 +16048,9 @@
 </histogram>
 
 <histogram name="DomainReliability.ReportedBeaconUploadDepth" units="levels">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     The upload depth included in a beacon saved to be uploaded to the collector.
@@ -16040,6 +16061,9 @@
 
 <histogram name="DomainReliability.SetConfigRecreatedContext"
     enum="BooleanCreated">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     When Domain Reliability receives a valid NEL configuration header for an
@@ -16049,6 +16073,9 @@
 </histogram>
 
 <histogram name="DomainReliability.UploadCollectorIndex">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     The index of the collector that a Domain Reliability upload was sent to.
@@ -16057,6 +16084,9 @@
 </histogram>
 
 <histogram name="DomainReliability.UploadCollectorRetryDelay" units="ms">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     After an upload to a collector finishes (successfully or not), the delay
@@ -16087,6 +16117,9 @@
 </histogram>
 
 <histogram name="DomainReliability.UploadInterval" units="ms">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     The time between successive Domain Reliability uploads being started in the
@@ -16096,6 +16129,9 @@
 </histogram>
 
 <histogram name="DomainReliability.UploadIntervalGlobal" units="ms">
+  <obsolete>
+    Removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     The time between successive Domain Reliability uploads being started across
@@ -45153,6 +45189,9 @@
 </histogram>
 
 <histogram name="Net.ResponseSizeByProcess.Browser" units="KB">
+  <obsolete>
+    The code to record this histogram was removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     Count of (post-SSL/proxy, pre-filter) kilobytes received per request made by
@@ -45161,6 +45200,9 @@
 </histogram>
 
 <histogram name="Net.ResponseSizeByProcess.Renderer" units="KB">
+  <obsolete>
+    The code to record this histogram was removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     Count of (post-SSL/proxy, pre-filter) kilobytes received per request made by
@@ -45169,6 +45211,9 @@
 </histogram>
 
 <histogram name="Net.ResponseSizeByProcess.Unknown" units="KB">
+  <obsolete>
+    The code to record this histogram was removed November 2017.
+  </obsolete>
   <owner>juliatuttle@chromium.org</owner>
   <summary>
     Count of (post-SSL/proxy, pre-filter) kilobytes received per request made by