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

Unified Diff: net/spdy/spdy_session.cc

Issue 10233016: Add a new UMA histogram for tracking SpdySessionErrorDetails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 8 years, 8 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/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 4f2ac3adc54d069094f7338771ba13c81b728f38..5f2cbbb429483c4140c9cdb08b58dd7a4f5a8222 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -497,6 +497,7 @@ int SpdySession::GetPushStream(
(url.SchemeIs("https") || url.SchemeIs("wss"))) {
CloseSessionOnError(
static_cast<net::Error>(certificate_error_code_),
+ REQUST_FOR_SECURE_CONTENT_OVER_INSECURE_SESSION,
true,
"Tried to get SPDY stream for secure content over an unauthenticated "
"session.");
@@ -599,6 +600,7 @@ int SpdySession::CreateStreamImpl(
(url.SchemeIs("https") || url.SchemeIs("wss"))) {
CloseSessionOnError(
static_cast<net::Error>(certificate_error_code_),
+ REQUST_FOR_SECURE_CONTENT_OVER_INSECURE_SESSION,
true,
"Tried to create SPDY stream for secure content over an "
"unauthenticated session.");
@@ -876,7 +878,8 @@ void SpdySession::OnReadComplete(int bytes_read) {
net::Error error = static_cast<net::Error>(bytes_read);
if (bytes_read == 0)
error = ERR_CONNECTION_CLOSED;
- CloseSessionOnError(error, true, "bytes_read is <= 0.");
+ CloseSessionOnError(error, READ_FAILED, true,
+ "bytes_read is <= 0.");
return;
}
@@ -954,7 +957,8 @@ void SpdySession::OnWriteComplete(int result) {
// The stream is now errored. Close it down.
CloseSessionOnError(
- static_cast<net::Error>(result), true, "The stream has errored.");
+ static_cast<net::Error>(result), WRITE_FAILED, true,
+ "The stream has errored.");
}
}
@@ -976,7 +980,8 @@ net::Error SpdySession::ReadSocket() {
switch (bytes_read) {
case 0:
// Socket is closed!
- CloseSessionOnError(ERR_CONNECTION_CLOSED, true, "bytes_read is 0.");
+ CloseSessionOnError(ERR_CONNECTION_CLOSED, READ_FAILED, true,
+ "bytes_read is 0.");
return ERR_CONNECTION_CLOSED;
case net::ERR_IO_PENDING:
// Waiting for data. Nothing to do now.
@@ -1043,7 +1048,8 @@ void SpdySession::WriteSocket() {
reinterpret_cast<const SpdyControlFrame&>(uncompressed_frame)));
if (!compressed_frame.get()) {
CloseSessionOnError(
- net::ERR_SPDY_PROTOCOL_ERROR, true, "SPDY Compression failure.");
+ net::ERR_SPDY_PROTOCOL_ERROR, SPDY_COMPRESSION_FAILURE, true,
+ "SPDY Compression failure.");
return;
}
@@ -1140,8 +1146,15 @@ void SpdySession::QueueFrame(SpdyFrame* frame,
}
void SpdySession::CloseSessionOnError(net::Error err,
+ SpdySessionErrorDetails details,
bool remove_from_pool,
const std::string& description) {
+ UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionErrorDetails", details,
+ NUM_SPDY_SESSION_ERROR_DETAILS);
+ if (EndsWith(host_port_pair().host(), "google.com", false)) {
+ UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionErrorDetails_Google", details,
+ NUM_SPDY_SESSION_ERROR_DETAILS);
+ }
// Closing all streams can have a side-effect of dropping the last reference
// to |this|. Hold a reference through this function.
scoped_refptr<SpdySession> self(this);
@@ -1322,10 +1335,12 @@ SSLClientCertType SpdySession::GetDomainBoundCertType() const {
return GetSSLClientSocket()->domain_bound_cert_type();
}
-void SpdySession::OnError(int error_code) {
+void SpdySession::OnError(SpdyFramer::SpdyError error_code) {
std::string description = base::StringPrintf(
"SPDY_ERROR error_code: %d.", error_code);
- CloseSessionOnError(net::ERR_SPDY_PROTOCOL_ERROR, true, description);
+ CloseSessionOnError(net::ERR_SPDY_PROTOCOL_ERROR,
+ static_cast<SpdySessionErrorDetails>(error_code),
+ true, description);
}
void SpdySession::OnStreamError(SpdyStreamId stream_id,
@@ -1621,7 +1636,8 @@ void SpdySession::OnPing(const SpdyPingControlFrame& frame) {
--pings_in_flight_;
if (pings_in_flight_ < 0) {
CloseSessionOnError(
- net::ERR_SPDY_PROTOCOL_ERROR, true, "pings_in_flight_ is < 0.");
+ net::ERR_SPDY_PROTOCOL_ERROR, UNEXPECTED_PING, true,
+ "pings_in_flight_ is < 0.");
return;
}
@@ -1861,7 +1877,8 @@ void SpdySession::CheckPingStatus(base::TimeTicks last_check_time) {
base::TimeDelta delay = hung_interval_ - (now - received_data_time_);
if (delay.InMilliseconds() < 0 || received_data_time_ < last_check_time) {
- CloseSessionOnError(net::ERR_SPDY_PING_FAILED, true, "Failed ping.");
+ CloseSessionOnError(net::ERR_SPDY_PING_FAILED, PING_FAILED, true,
+ "Failed ping.");
// Track all failed PING messages in a separate bucket.
const base::TimeDelta kFailedPing =
base::TimeDelta::FromInternalValue(INT_MAX);

Powered by Google App Engine
This is Rietveld 408576698