Commit db487b67 authored by Michael Crouse's avatar Michael Crouse Committed by Commit Bot

Update Datause.BytesReceived histogram.

The DataUse.BytesReceived histogram does not cover larger reports from
the OS and makes it difficult to measure changes in data use.

Bug: 1132481
Change-Id: I2a0df744f0178ce16aad75cf024c86f28b0d11aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459792
Commit-Queue: Ilya Sherman <isherman@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Reviewed-by: default avatarWeilun Shi <sweilun@chromium.org>
Reviewed-by: default avatarrajendrant <rajendrant@chromium.org>
Auto-Submit: Michael Crouse <mcrouse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818182}
parent 79f4bf20
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h" #include "base/numerics/safe_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
...@@ -100,8 +101,9 @@ void ChromeDataUseMeasurement::ReportNetworkServiceDataUse( ...@@ -100,8 +101,9 @@ void ChromeDataUseMeasurement::ReportNetworkServiceDataUse(
int64_t recv_bytes, int64_t recv_bytes,
int64_t sent_bytes) { int64_t sent_bytes) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Negative byte numbres is not a critical problem (i.e. should have no security implications) but // Negative byte numbers is not a critical problem (i.e., should have no
// is not expected. TODO(rajendrant): remove these DCHECKs or consider using uint in Mojo instead. // security implications) but is not expected. TODO(rajendrant): remove these
// DCHECKs or consider using uint in Mojo instead.
DCHECK_GE(recv_bytes, 0); DCHECK_GE(recv_bytes, 0);
DCHECK_GE(sent_bytes, 0); DCHECK_GE(sent_bytes, 0);
...@@ -125,7 +127,8 @@ void ChromeDataUseMeasurement::ReportNetworkServiceDataUse( ...@@ -125,7 +127,8 @@ void ChromeDataUseMeasurement::ReportNetworkServiceDataUse(
observer.OnServicesDataUse(network_traffic_annotation_id_hash, recv_bytes, observer.OnServicesDataUse(network_traffic_annotation_id_hash, recv_bytes,
sent_bytes); sent_bytes);
} }
UMA_HISTOGRAM_COUNTS_1M("DataUse.BytesReceived.Delegate", recv_bytes); base::UmaHistogramCustomCounts("DataUse.BytesReceived2.Delegate", recv_bytes,
50, 10 * 1000 * 1000, 50);
UMA_HISTOGRAM_COUNTS_1M("DataUse.BytesSent.Delegate", sent_bytes); UMA_HISTOGRAM_COUNTS_1M("DataUse.BytesSent.Delegate", sent_bytes);
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h" #include "base/metrics/sparse_histogram.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
...@@ -197,13 +198,17 @@ void DataUseMeasurement::MaybeRecordNetworkBytesOS(bool force_record_metrics) { ...@@ -197,13 +198,17 @@ void DataUseMeasurement::MaybeRecordNetworkBytesOS(bool force_record_metrics) {
if (bytes > rx_bytes_os_) { if (bytes > rx_bytes_os_) {
int64_t incremental_bytes = bytes - rx_bytes_os_; int64_t incremental_bytes = bytes - rx_bytes_os_;
// Do not record samples with value 0. // Do not record samples with value 0.
UMA_HISTOGRAM_COUNTS_1M("DataUse.BytesReceived.OS", incremental_bytes); base::UmaHistogramCustomCounts("DataUse.BytesReceived2.OS",
incremental_bytes, 50, 10 * 1000 * 1000,
50);
if (IsInForeground(app_state_)) { if (IsInForeground(app_state_)) {
UMA_HISTOGRAM_COUNTS_1M("DataUse.BytesReceived.OS.Foreground", base::UmaHistogramCustomCounts("DataUse.BytesReceived2.OS.Foreground",
incremental_bytes); incremental_bytes, 50,
10 * 1000 * 1000, 50);
} else { } else {
UMA_HISTOGRAM_COUNTS_1M("DataUse.BytesReceived.OS.Background", base::UmaHistogramCustomCounts("DataUse.BytesReceived2.OS.Background",
incremental_bytes); incremental_bytes, 50,
10 * 1000 * 1000, 50);
} }
} }
} }
......
...@@ -4486,6 +4486,7 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -4486,6 +4486,7 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
label="As reported by the operating system. Currently logged only on label="As reported by the operating system. Currently logged only on
Android."/> Android."/>
<affected-histogram name="DataUse.BytesReceived"/> <affected-histogram name="DataUse.BytesReceived"/>
<affected-histogram name="DataUse.BytesReceived2"/>
<affected-histogram name="DataUse.BytesSent"/> <affected-histogram name="DataUse.BytesSent"/>
</histogram_suffixes> </histogram_suffixes>
...@@ -4493,8 +4494,13 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -4493,8 +4494,13 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<suffix name="Background" <suffix name="Background"
label="Data use was recorded with Chrome in background."/> label="Data use was recorded with Chrome in background."/>
<suffix name="Foreground" <suffix name="Foreground"
label="Data use was recorded with Chrome in foregorund."/> label="Data use was recorded with Chrome in foreground."/>
<affected-histogram name="DataUse.BytesReceived.OS"/> <affected-histogram name="DataUse.BytesReceived.OS">
<obsolete>
Replaced by DataUse.BytesReceived2.OS in October, 2020.
</obsolete>
</affected-histogram>
<affected-histogram name="DataUse.BytesReceived2.OS"/>
<affected-histogram name="DataUse.BytesSent.OS"/> <affected-histogram name="DataUse.BytesSent.OS"/>
</histogram_suffixes> </histogram_suffixes>
......
...@@ -3146,6 +3146,10 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -3146,6 +3146,10 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</histogram> </histogram>
<histogram name="DataUse.BytesReceived" units="bytes" expires_after="M90"> <histogram name="DataUse.BytesReceived" units="bytes" expires_after="M90">
<obsolete>
Replaced with DataUse.BytesReceived2 as of 10/2020 to provide more granular
buckets above 1 MB
</obsolete>
<owner>rajendrant@chromium.org</owner> <owner>rajendrant@chromium.org</owner>
<owner>mcrouse@chromium.org</owner> <owner>mcrouse@chromium.org</owner>
<summary> <summary>
...@@ -3154,6 +3158,15 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -3154,6 +3158,15 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="DataUse.BytesReceived2" units="bytes" expires_after="M92">
<owner>rajendrant@chromium.org</owner>
<owner>mcrouse@chromium.org</owner>
<summary>
Count of total bytes received by the Chrome on the network. This is recorded
when requests complete.
</summary>
</histogram>
<histogram name="DataUse.BytesSent" units="bytes" expires_after="M90"> <histogram name="DataUse.BytesSent" units="bytes" expires_after="M90">
<owner>rajendrant@chromium.org</owner> <owner>rajendrant@chromium.org</owner>
<owner>mcrouse@chromium.org</owner> <owner>mcrouse@chromium.org</owner>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment