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

Unified Diff: net/websockets/websocket_basic_handshake_stream.cc

Issue 336753002: Add Net.WebSocket.ResponseCode and ErrorCodes UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bogus indent. Created 6 years, 6 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 | « no previous file | net/websockets/websocket_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a51fee2a45c77358bcf662e1d75661f649a60db7 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"
@@ -552,9 +553,14 @@ 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", response_code);
+ switch (response_code) {
case HTTP_SWITCHING_PROTOCOLS:
OnFinishOpeningHandshake();
return ValidateUpgradeResponse(headers);
« no previous file with comments | « no previous file | net/websockets/websocket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698