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

Unified Diff: net/websockets/websocket_stream.cc

Issue 336753002: Add Net.WebSocket.ResponseCode and ErrorCodes UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use sprae histogram for result code. 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
Index: net/websockets/websocket_stream.cc
diff --git a/net/websockets/websocket_stream.cc b/net/websockets/websocket_stream.cc
index 9880ea800203e0fd48a9182da455476d8f3dc2f8..72e6482cc3b99c4d761ff79215c971ddc9116dad 100644
--- a/net/websockets/websocket_stream.cc
+++ b/net/websockets/websocket_stream.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/sparse_histogram.h"
#include "net/base/load_flags.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
@@ -178,14 +179,18 @@ class SSLErrorCallbacks : public WebSocketEventInterface::SSLErrorCallbacks {
};
void Delegate::OnResponseStarted(URLRequest* request) {
+ // All error codes, including OK and ABORTED, as with
+ // Net.ErrorCodesForMainFrame3
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Net.WebSocket.ErrorCodes",
+ -request->status().error());
if (!request->status().is_success()) {
DVLOG(3) << "OnResponseStarted (request failed)";
owner_->ReportFailure();
return;
}
- DVLOG(3) << "OnResponseStarted (response code " << request->GetResponseCode()
- << ")";
- switch (request->GetResponseCode()) {
+ const int response_code = request->GetResponseCode();
+ DVLOG(3) << "OnResponseStarted (response code " << response_code << ")";
+ switch (response_code) {
Alexei Svitkine (slow) 2014/06/18 16:50:41 Nit: Bad indent.
Adam Rice 2014/06/19 02:24:07 Done.
case HTTP_SWITCHING_PROTOCOLS:
result_ = CONNECTED;
owner_->PerformUpgrade();

Powered by Google App Engine
This is Rietveld 408576698