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

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: It turns out we need to count net error codes in websocket_stream.cc after all. 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..a791a65461019439563a9f3187d22b5be3953bf2 100644
--- a/net/websockets/websocket_stream.cc
+++ b/net/websockets/websocket_stream.cc
@@ -7,9 +7,11 @@
#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"
+#include "net/http/http_util.h"
yhirano 2014/06/17 10:52:44 Do you need this line?
Adam Rice 2014/06/18 01:23:19 No. Removed.
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
#include "net/websockets/websocket_errors.h"
@@ -178,14 +180,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) {
case HTTP_SWITCHING_PROTOCOLS:
result_ = CONNECTED;
owner_->PerformUpgrade();

Powered by Google App Engine
This is Rietveld 408576698