Commit 4849a807 authored by gayane's avatar gayane Committed by Commit bot

Histogram for UMA log upload connection type.

Added a histogram to log the network connection type for each successful metrics log upload. Will be used to monitor cellular uploads on Chrome on Android.

BUG=455847

Review URL: https://codereview.chromium.org/1033493002

Cr-Commit-Position: refs/heads/master@{#322593}
parent cb2b8701
......@@ -6,9 +6,23 @@
#include "base/metrics/histogram.h"
#include "net/base/load_flags.h"
#include "net/base/network_change_notifier.h"
#include "net/url_request/url_fetcher.h"
#include "url/gurl.h"
namespace {
// Records the network connection type if upload was successful.
void RecordConnectionType(int response_code) {
if (response_code == 200) {
UMA_HISTOGRAM_ENUMERATION("UMA.LogUpload.ConnetionType",
net::NetworkChangeNotifier::GetConnectionType(),
net::NetworkChangeNotifier::CONNECTION_LAST);
}
}
} // namespace
namespace metrics {
NetMetricsLogUploader::NetMetricsLogUploader(
......@@ -54,6 +68,7 @@ void NetMetricsLogUploader::OnURLFetchComplete(const net::URLFetcher* source) {
if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID)
response_code = -1;
current_fetch_.reset();
RecordConnectionType(response_code);
on_upload_complete_.Run(response_code);
}
......
......@@ -41,6 +41,9 @@ class NET_EXPORT NetworkChangeNotifier {
//
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net
//
// New enum values should only be added to the end of the enum and no values
// should be modified or reused, as this is reported via UMA.
enum ConnectionType {
CONNECTION_UNKNOWN = 0, // A connection exists, but its type is unknown.
// Also used as a default value.
......
......@@ -40869,6 +40869,14 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="UMA.LogUpload.ConnetionType" enum="NetworkConnectionType">
<owner>asvitkine@chromium.org</owner>
<owner>gayane@chromium.org</owner>
<summary>
The network connection type for each successful metrics log upload.
</summary>
</histogram>
<histogram name="UMA.LowEntropySourceValue">
<owner>asvitkine@chromium.org</owner>
<summary>
......@@ -55311,6 +55319,17 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="1" label="IPv6"/>
</enum>
<enum name="NetworkConnectionType" type="int">
<int value="0" label="Unknown"/>
<int value="1" label="Ethernet"/>
<int value="2" label="WiFi"/>
<int value="3" label="2g"/>
<int value="4" label="3g"/>
<int value="5" label="4g"/>
<int value="6" label="None"/>
<int value="7" label="Bluetooth"/>
</enum>
<enum name="NetworkCorruptedProfile" type="int">
<int value="0" label="Corrupted Profile"/>
</enum>
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