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

Unified Diff: net/http/http_proxy_client_socket_wrapper.cc

Issue 2768173002: Record the time duration for establishing proxy connection (Closed)
Patch Set: Address error histogram Created 3 years, 9 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
« no previous file with comments | « net/http/http_proxy_client_socket_wrapper.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_proxy_client_socket_wrapper.cc
diff --git a/net/http/http_proxy_client_socket_wrapper.cc b/net/http/http_proxy_client_socket_wrapper.cc
index b209a5af46710d743f896bf013eb89e474ea56ae..0d939118eb62422d79f2c9fd735a6bde9aa71610 100644
--- a/net/http/http_proxy_client_socket_wrapper.cc
+++ b/net/http/http_proxy_client_socket_wrapper.cc
@@ -10,6 +10,7 @@
#include "base/bind_helpers.h"
#include "base/callback_helpers.h"
#include "base/memory/weak_ptr.h"
+#include "base/metrics/histogram_macros.h"
#include "base/profiler/scoped_tracker.h"
#include "base/values.h"
#include "net/base/proxy_delegate.h"
@@ -387,6 +388,7 @@ int HttpProxyClientSocketWrapper::DoLoop(int result) {
}
int HttpProxyClientSocketWrapper::DoBeginConnect() {
+ connect_start_time_ = base::TimeTicks::Now();
SetConnectTimer(connect_timeout_duration_);
if (transport_params_) {
next_state_ = STATE_TCP_CONNECT;
@@ -408,8 +410,11 @@ int HttpProxyClientSocketWrapper::DoTransportConnect() {
}
int HttpProxyClientSocketWrapper::DoTransportConnectComplete(int result) {
- if (result != OK)
+ if (result != OK) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpProxy.ConnectLatency.Insecure.Error",
+ base::TimeTicks::Now() - connect_start_time_);
return ERR_PROXY_CONNECTION_FAILED;
+ }
// Reset the timer to just the length of time allowed for HttpProxy handshake
// so that a fast TCP connection plus a slow HttpProxy failure doesn't take
@@ -445,6 +450,8 @@ int HttpProxyClientSocketWrapper::DoSSLConnectComplete(int result) {
if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
DCHECK(
transport_socket_handle_->ssl_error_response_info().cert_request_info);
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpProxy.ConnectLatency.Secure.Error",
+ base::TimeTicks::Now() - connect_start_time_);
error_response_info_.reset(new HttpResponseInfo(
transport_socket_handle_->ssl_error_response_info()));
error_response_info_->cert_request_info->is_proxy = true;
@@ -452,6 +459,8 @@ int HttpProxyClientSocketWrapper::DoSSLConnectComplete(int result) {
}
if (IsCertificateError(result)) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpProxy.ConnectLatency.Secure.Error",
+ base::TimeTicks::Now() - connect_start_time_);
if (ssl_params_->load_flags() & LOAD_IGNORE_ALL_CERT_ERRORS) {
result = OK;
} else {
@@ -469,6 +478,8 @@ int HttpProxyClientSocketWrapper::DoSSLConnectComplete(int result) {
return ERR_SPDY_SESSION_ALREADY_EXISTS;
}
if (result < 0) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpProxy.ConnectLatency.Secure.Error",
+ base::TimeTicks::Now() - connect_start_time_);
if (transport_socket_handle_->socket())
transport_socket_handle_->socket()->Disconnect();
return ERR_PROXY_CONNECTION_FAILED;
@@ -501,6 +512,14 @@ int HttpProxyClientSocketWrapper::DoSSLConnectComplete(int result) {
int HttpProxyClientSocketWrapper::DoHttpProxyConnect() {
next_state_ = STATE_HTTP_PROXY_CONNECT_COMPLETE;
+ if (transport_params_) {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpProxy.ConnectLatency.Insecure.Success",
+ base::TimeTicks::Now() - connect_start_time_);
+ } else {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpProxy.ConnectLatency.Secure.Success",
+ base::TimeTicks::Now() - connect_start_time_);
+ }
+
// Add a HttpProxy connection on top of the tcp socket.
transport_socket_.reset(new HttpProxyClientSocket(
transport_socket_handle_.release(), user_agent_, endpoint_,
@@ -618,6 +637,18 @@ void HttpProxyClientSocketWrapper::ConnectTimeout() {
DCHECK_NE(STATE_NONE, next_state_);
DCHECK(!connect_callback_.is_null());
+ if (next_state_ == STATE_TCP_CONNECT_COMPLETE ||
+ next_state_ == STATE_SSL_CONNECT_COMPLETE) {
+ if (transport_params_) {
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ "Net.HttpProxy.ConnectLatency.Insecure.TimedOut",
+ base::TimeTicks::Now() - connect_start_time_);
+ } else {
+ UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpProxy.ConnectLatency.Secure.TimedOut",
+ base::TimeTicks::Now() - connect_start_time_);
+ }
+ }
+
NotifyProxyDelegateOfCompletion(ERR_CONNECTION_TIMED_OUT);
CompletionCallback callback = connect_callback_;
« no previous file with comments | « net/http/http_proxy_client_socket_wrapper.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698