diff --git a/chrome/browser/media/webrtc/webrtc_log_uploader.cc b/chrome/browser/media/webrtc/webrtc_log_uploader.cc index a892aa2d548f2..0b1436923d729 100644 --- a/chrome/browser/media/webrtc/webrtc_log_uploader.cc +++ b/chrome/browser/media/webrtc/webrtc_log_uploader.cc @@ -18,6 +18,7 @@ #include "base/time/time.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" #include "chrome/browser/net/system_network_context_manager.h" #include "components/version_info/version_info.h" #include "components/webrtc_logging/browser/log_cleanup.h" @@ -192,6 +193,9 @@ void WebRtcLogUploader::UploadStoredLog( DPLOG(WARNING) << "Could not read WebRTC log file."; base::UmaHistogramSparse("WebRtcTextLogging.UploadFailed", upload_data.web_app_id); + base::UmaHistogramSparse( + "WebRtcTextLogging.UploadFailureReason", + WebRtcLoggingHandlerHost::UploadFailureReason::kStoredLogNotFound); base::PostTaskWithTraits( FROM_HERE, {BrowserThread::UI}, base::BindOnce(upload_data.callback, false, "", "Log doesn't exist.")); @@ -653,6 +657,8 @@ void WebRtcLogUploader::NotifyUploadDone( } else { base::UmaHistogramSparse("WebRtcTextLogging.UploadFailed", upload_done_data.web_app_id); + base::UmaHistogramSparse("WebRtcTextLogging.UploadFailureReason", + response_code); error_message = "Uploading failed, response code: " + base::IntToString(response_code); } diff --git a/chrome/browser/media/webrtc/webrtc_logging_handler_host.cc b/chrome/browser/media/webrtc/webrtc_logging_handler_host.cc index 0404c2ae55ef6..35872e0be7b0e 100644 --- a/chrome/browser/media/webrtc/webrtc_logging_handler_host.cc +++ b/chrome/browser/media/webrtc/webrtc_logging_handler_host.cc @@ -530,8 +530,11 @@ void WebRtcLoggingHandlerHost::DoUploadLogAndRtpDumps( // If the channel is closing we don't log failure to UMA for consistency, // since there are other cases during shutdown were we don't get a chance // to log. - if (!channel_is_closing) + if (!channel_is_closing) { base::UmaHistogramSparse("WebRtcTextLogging.UploadFailed", web_app_id_); + base::UmaHistogramSparse("WebRtcTextLogging.UploadFailureReason", + UploadFailureReason::kInvalidState); + } base::PostTaskWithTraits( FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(callback, false, "", diff --git a/chrome/browser/media/webrtc/webrtc_logging_handler_host.h b/chrome/browser/media/webrtc/webrtc_logging_handler_host.h index 235fb09757813..34404c8ff3d0a 100644 --- a/chrome/browser/media/webrtc/webrtc_logging_handler_host.h +++ b/chrome/browser/media/webrtc/webrtc_logging_handler_host.h @@ -65,6 +65,14 @@ class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { // Key used to attach the handler to the RenderProcessHost. static const char kWebRtcLoggingHandlerHostKey[]; + // Upload failure reasons used for UMA stats. A failure reason can be one of + // those listed here or a response code for the upload HTTP request. The + // values in this list must be less than 100 and cannot be changed. + enum UploadFailureReason { + kInvalidState = 0, + kStoredLogNotFound = 1, + }; + WebRtcLoggingHandlerHost(int render_process_id, content::BrowserContext* browser_context, WebRtcLogUploader* log_uploader); diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index a8a75da4a5236..04fcd93fcc010 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml @@ -53555,6 +53555,58 @@ Full version information for the fingerprint enum values: + + + Failure reason can be either a response code (except 200 OK) for the upload + HTTP request, or another reason prior to uploading (values less than 100). + HTTP response codes copied from enum "HttpResponseCode". + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index b8552e3b61772..ff12ad5a8911f 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -126349,7 +126349,7 @@ uploading your change for review. + enum="WebRtcLoggingWebAppIdHash" expires_after="2019-07-01"> grunell@chromium.org Counts the number of WebRTC text log events per web application. Suffixed by @@ -126357,6 +126357,15 @@ uploading your change for review. + + grunell@chromium.org + + Counts upload failures for WebRTC text log. Recorded when an upload attempt + fails. + + + mgiuca@chromium.org