From f1c950543990d7048e2323c106a11350fe95ab15 Mon Sep 17 00:00:00 2001 From: bnc Date: Tue, 16 Sep 2014 06:30:57 -0700 Subject: [PATCH] Introduce new SPDY Version UMA histogram. The Net.SpdyVersion UMA histogram directly tracks internal NextProto enum values, which change, for example, when protocols are deprecated, e.g., https://chromium.googlesource.com/chromium/src/+/13621d68bc4096987471ec698468a972af2fa1de%5E%21/#F9. This CL obsoletes Net.SpdyVersion, and introduces Net.SpdyVersion2, which uses values that are specifically generated for this purpuse, with the intent that later versions will not change or reuse them. BUG=412495 Review URL: https://codereview.chromium.org/560573002 Cr-Commit-Position: refs/heads/master@{#295053} --- net/socket/next_proto.h | 15 ++++++++------- net/spdy/spdy_session.cc | 5 ++++- net/spdy/spdy_test_util_common.cc | 9 ++++++--- tools/metrics/histograms/histograms.xml | 31 +++++++++++++++++++++++++++---- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/net/socket/next_proto.h b/net/socket/next_proto.h index 19ff55e0bc02..08e680153279 100644 --- a/net/socket/next_proto.h +++ b/net/socket/next_proto.h @@ -14,20 +14,21 @@ 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 recognise. +// protocols that we recognise. Do not change or reuse values, because they +// are used to collect statistics on UMA. enum NextProto { kProtoUnknown = 0, - kProtoHTTP11, + kProtoHTTP11 = 1, kProtoMinimumVersion = kProtoHTTP11, - kProtoDeprecatedSPDY2, + kProtoDeprecatedSPDY2 = 100, kProtoSPDYMinimumVersion = kProtoDeprecatedSPDY2, - kProtoSPDY3, - kProtoSPDY31, - kProtoSPDY4, // SPDY4 is HTTP/2. + kProtoSPDY3 = 101, + kProtoSPDY31 = 102, + kProtoSPDY4 = 103, // SPDY4 is HTTP/2. kProtoSPDYMaximumVersion = kProtoSPDY4, - kProtoQUIC1SPDY3, + kProtoQUIC1SPDY3 = 200, kProtoMaximumVersion = kProtoQUIC1SPDY3, }; diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index fc22ae4ea04d..64fb84e4595f 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -719,7 +719,10 @@ void SpdySession::InitializeWithSocket( enable_compression_)); buffered_spdy_framer_->set_visitor(this); buffered_spdy_framer_->set_debug_visitor(this); - UMA_HISTOGRAM_ENUMERATION("Net.SpdyVersion", protocol_, kProtoMaximumVersion); + UMA_HISTOGRAM_ENUMERATION( + "Net.SpdyVersion2", + protocol_ - kProtoSPDYMinimumVersion, + kProtoSPDYMaximumVersion - kProtoSPDYMinimumVersion + 1); #if defined(SPDY_PROXY_AUTH_ORIGIN) UMA_HISTOGRAM_BOOLEAN("Net.SpdySessions_DataReductionProxy", host_port_pair().Equals(HostPortPair::FromURL( diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc index 99c0747bdadc..5de58d674f2a 100644 --- a/net/spdy/spdy_test_util_common.cc +++ b/net/spdy/spdy_test_util_common.cc @@ -53,9 +53,12 @@ void ParseUrl(base::StringPiece url, std::string* scheme, std::string* host, NextProtoVector SpdyNextProtos() { NextProtoVector next_protos; - for (int i = kProtoMinimumVersion; i <= kProtoMaximumVersion; ++i) { - next_protos.push_back(static_cast(i)); - } + next_protos.push_back(kProtoHTTP11); + next_protos.push_back(kProtoDeprecatedSPDY2); + next_protos.push_back(kProtoSPDY3); + next_protos.push_back(kProtoSPDY31); + next_protos.push_back(kProtoSPDY4); + next_protos.push_back(kProtoQUIC1SPDY3); return next_protos; } diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 08e59e822796..6d077228eab9 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -17450,12 +17450,25 @@ Therefore, the affected-histogram name has to have at least one dot in it. + + Deprecated on 2014-09-11, because the uploaded values were changing as + protocols were removed, therefore statistics couldn't be combined accross + different builds. Replaced by Net.SpdyVersion2. + rch@chromium.org The SPDY protocol version that is used to talk to SPDY servers. + + bnc@chromium.org + + The SPDY protocol version that is used to talk to SPDY servers. Logged + every time a SPDY session is initialized. + + + agl@chromium.org rsleevi@chromium.org @@ -48643,10 +48656,10 @@ To add a new entry, add it with any value and run test to compute valid value. - - - - + + + + @@ -50043,6 +50056,16 @@ To add a new entry, add it with any value and run test to compute valid value. + + + |enum NextProto| values, with |kProtoSPDYMinimumVersion| subtracted. + + + + + + + -- 2.11.4.GIT