Commit bd442c23 authored by bnc's avatar bnc Committed by Commit bot

Replace SSLProtocolNegotiation histogram with SSLNegotiatedAlpnProtocol.

* Replace sparse histogram recording ALPN/NPN usage and whether there was
  overlap or fallback in case of NPN with a new histogram with much fewer
  values.  This was made possible by NPN being disabled.
* New histogram is recorded with all TLS handshakes, telling us what
  percentage of total TLS connections use HTTP/2.  (The old histogram was only
  recorded when either NPN or ALPN was used, depriving us of this piece of
  information.)
* Remove fixed values from enum NextProto; remove commented out historical
  values.  Note that git cl format puts the new enum on a single line.

BUG=526713

Review-Url: https://codereview.chromium.org/2243453002
Cr-Commit-Position: refs/heads/master@{#418664}
parent e1ac59e4
......@@ -11,24 +11,14 @@
namespace net {
// Next Protocol Negotiation (NPN), if successful, results in agreement on an
// application-level string that specifies the application level protocol to
// use over the TLS connection. NextProto enumerates the application level
// protocols that we recognize. Do not change or reuse values, because they
// are used to collect statistics on UMA. Also, values must be in [0,499),
// because of the way TLS protocol negotiation extension information is added to
// UMA histogram.
const int kProtoSPDYHistogramOffset = 100;
// This enum is used in Net.SSLNegotiatedAlpnProtocol histogram.
// Do not change or re-use values.
enum NextProto {
kProtoUnknown = 0,
kProtoHTTP11 = 1,
// kProtoSPDY31 = 102,
// kProtoHTTP2_14 = 103, // HTTP/2 draft-14
// kProtoHTTP2_15 = 104, // HTTP/2 draft-15
// kProtoHTTP2_16 = 105, // HTTP/2 draft-16
// kProtoHTTP2_17 = 106, // HTTP/2 draft-17
kProtoHTTP2 = 107, // HTTP/2, see https://tools.ietf.org/html/rfc7540.
kProtoQUIC1SPDY3 = 200,
kProtoHTTP2 = 2,
kProtoQUIC1SPDY3 = 3,
kProtoLast = kProtoQUIC1SPDY3
};
// List of protocols to use for NPN, used for configuring HttpNetworkSessions.
......
......@@ -1219,7 +1219,7 @@ int SSLClientSocketImpl::DoHandshakeComplete(int result) {
}
}
RecordNegotiationExtension();
RecordNegotiatedProtocol();
RecordChannelIDSupport();
const uint8_t* ocsp_response_raw;
......@@ -2337,26 +2337,9 @@ void SSLClientSocketImpl::LogConnectEndEvent(int rv) {
base::Bind(&NetLogSSLInfoCallback, base::Unretained(this)));
}
void SSLClientSocketImpl::RecordNegotiationExtension() const {
if (negotiation_extension_ == kExtensionUnknown)
return;
if (npn_status_ == kNextProtoUnsupported)
return;
base::HistogramBase::Sample sample =
static_cast<base::HistogramBase::Sample>(negotiated_protocol_);
// In addition to the protocol negotiated, we want to record which TLS
// extension was used, and in case of NPN, whether there was overlap between
// server and client list of supported protocols.
if (negotiation_extension_ == kExtensionNPN) {
if (npn_status_ == kNextProtoNoOverlap) {
sample += 1000;
} else {
sample += 500;
}
} else {
DCHECK_EQ(kExtensionALPN, negotiation_extension_);
}
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample);
void SSLClientSocketImpl::RecordNegotiatedProtocol() const {
UMA_HISTOGRAM_ENUMERATION("Net.SSLNegotiatedAlpnProtocol",
negotiated_protocol_, kProtoLast + 1);
}
void SSLClientSocketImpl::RecordChannelIDSupport() const {
......
......@@ -240,9 +240,9 @@ class SSLClientSocketImpl : public SSLClientSocket {
void LogConnectEndEvent(int rv);
// Record which TLS extension was used to negotiate protocol and protocol
// chosen in a UMA histogram.
void RecordNegotiationExtension() const;
// Record whether ALPN was used, and if so, the negotiated protocol,
// in a UMA histogram.
void RecordNegotiatedProtocol() const;
// Records histograms for channel id support during full handshakes - resumed
// handshakes are ignored.
......
......@@ -32873,6 +32873,15 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<summary>Time to complete a speculative certificate verification.</summary>
</histogram>
<histogram name="Net.SSLNegotiatedAlpnProtocol"
enum="SSLNegotiatedAlpnProtocol">
<owner>bnc@chromium.org</owner>
<summary>
For each TLS handshake, whether ALPN was negotiated; and if so, the
negotiated protocol.
</summary>
</histogram>
<histogram name="Net.SSLProtocolErrorCipher" enum="SSLCipherSuite">
<obsolete>
Removed in March 2016.
......@@ -32899,6 +32908,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</histogram>
<histogram name="Net.SSLProtocolNegotiation" enum="SSLProtocolNegotiation">
<obsolete>
Superseded by Net.SSLNegotiatedAlpnProtocol in 2016 August.
</obsolete>
<owner>bnc@chromium.org</owner>
<summary>
TLS extension used to negotiate protocol (ALPN or NPN); in case of NPN,
......@@ -96408,6 +96420,12 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="3" label="NOT_EXPIRED_AND_DO_NOT_PROCEED"/>
</enum>
<enum name="SSLNegotiatedAlpnProtocol" type="int">
<int value="0" label="ALPN not used"/>
<int value="1" label="HTTP/1.1 negotiated via ALPN"/>
<int value="2" label="HTTP/2 negotiated via ALPN"/>
</enum>
<enum name="SSLOrQUICVersion" type="int">
<int value="0" label="Unknown"/>
<int value="1" label="SSL 2.0"/>
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