Index: net/websockets/websocket_basic_handshake_stream.cc |
diff --git a/net/websockets/websocket_basic_handshake_stream.cc b/net/websockets/websocket_basic_handshake_stream.cc |
index a4a634e038bb703eadd207a7eb422e79b0015caf..b22944b056b0664aa485284ab1da179521acea64 100644 |
--- a/net/websockets/websocket_basic_handshake_stream.cc |
+++ b/net/websockets/websocket_basic_handshake_stream.cc |
@@ -15,6 +15,7 @@ |
#include "base/bind.h" |
#include "base/containers/hash_tables.h" |
#include "base/metrics/histogram.h" |
+#include "base/metrics/sparse_histogram.h" |
#include "base/stl_util.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/string_piece.h" |
@@ -28,6 +29,7 @@ |
#include "net/http/http_response_headers.h" |
#include "net/http/http_status_code.h" |
#include "net/http/http_stream_parser.h" |
+#include "net/http/http_util.h" |
#include "net/socket/client_socket_handle.h" |
#include "net/websockets/websocket_basic_stream.h" |
#include "net/websockets/websocket_deflate_predictor.h" |
@@ -552,9 +554,16 @@ void WebSocketBasicHandshakeStream::OnFinishOpeningHandshake() { |
int WebSocketBasicHandshakeStream::ValidateResponse(int rv) { |
DCHECK(http_response_info_); |
- const HttpResponseHeaders* headers = http_response_info_->headers.get(); |
+ // Most net errors happen during connection, so they are not seen by this |
+ // method. The histogram for error codes is created in |
+ // Delegate::OnResponseStarted in websocket_stream.cc instead. |
if (rv >= 0) { |
- switch (headers->response_code()) { |
+ const HttpResponseHeaders* headers = http_response_info_->headers.get(); |
+ const int response_code = headers->response_code(); |
+ UMA_HISTOGRAM_SPARSE_SLOWLY( |
+ "Net.WebSocket.ResponseCode", |
Alexei Svitkine (slow)
2014/06/18 16:50:41
Indent 2 more or don't wrap.
Adam Rice
2014/06/19 02:24:06
Done.
|
+ HttpUtil::MapStatusCodeForHistogram(response_code)); |
Alexei Svitkine (slow)
2014/06/18 16:50:41
You don't need MapStatusCodeForHistogram, just log
Adam Rice
2014/06/19 02:24:06
Done.
|
+ switch (response_code) { |
case HTTP_SWITCHING_PROTOCOLS: |
OnFinishOpeningHandshake(); |
return ValidateUpgradeResponse(headers); |