Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: net/socket/ssl_client_socket.cc

Issue 590513002: Add histogram to track NPN/ALPN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename protocol_negotation for clarity. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/socket/ssl_client_socket.cc
diff --git a/net/socket/ssl_client_socket.cc b/net/socket/ssl_client_socket.cc
index 4aacbc8d42db5faa1f4eb25cad3588efb37b752f..1235ed800f05ab3210991e4e42b074a5015257df 100644
--- a/net/socket/ssl_client_socket.cc
+++ b/net/socket/ssl_client_socket.cc
@@ -5,6 +5,7 @@
#include "net/socket/ssl_client_socket.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/sparse_histogram.h"
#include "base/strings/string_util.h"
#include "crypto/ec_private_key.h"
#include "net/base/host_port_pair.h"
@@ -19,7 +20,8 @@ SSLClientSocket::SSLClientSocket()
protocol_negotiated_(kProtoUnknown),
channel_id_sent_(false),
signed_cert_timestamps_received_(false),
- stapled_ocsp_response_received_(false) {
+ stapled_ocsp_response_received_(false),
+ negotiation_extension_(kExtensionUnknown) {
}
// static
@@ -124,6 +126,11 @@ void SSLClientSocket::set_protocol_negotiated(NextProto protocol_negotiated) {
protocol_negotiated_ = protocol_negotiated;
}
+void SSLClientSocket::set_negotiation_extension(
+ SSLNegotiationExtension negotiation_extension) {
+ negotiation_extension_ = negotiation_extension;
+}
+
bool SSLClientSocket::WasChannelIDSent() const {
return channel_id_sent_;
}
@@ -232,4 +239,28 @@ std::vector<uint8_t> SSLClientSocket::SerializeNextProtos(
return wire_protos;
}
+void SSLClientSocket::RecordNegotiationExtension() {
+ if (negotiation_extension_ == kExtensionUnknown)
+ return;
+ std::string proto;
+ SSLClientSocket::NextProtoStatus status = GetNextProto(&proto);
+ if (status == kNextProtoUnsupported)
+ return;
+ // Convert protocol into numerical value for histogram.
+ NextProto protocol_negotiated = SSLClientSocket::NextProtoFromString(proto);
+ base::HistogramBase::Sample sample =
+ static_cast<base::HistogramBase::Sample>(protocol_negotiated);
+ // 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 (status == kNextProtoNoOverlap) {
+ sample += 1000;
+ } else {
+ sample += 500;
davidben 2014/10/03 17:55:07 This is probably worth a comment in net/socket/nex
Bence 2014/10/10 15:26:10 Done.
+ }
+ }
davidben 2014/10/03 17:55:07 Nit: I'd put in an } else { DCHECK_EQ(kExten
Bence 2014/10/10 15:26:10 Done.
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample);
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698