Skip to content

Commit

Permalink
Histogram for WebRTC text log upload failure reason.
Browse files Browse the repository at this point in the history
This histogram is for all web apps in contrast with the other WebRTC text logging histograms.

Bug: 915679
Change-Id: I7f90cc6438db9a9e25f5c64e60ce9a4d4cf0f7a1
Reviewed-on: https://chromium-review.googlesource.com/c/1379957
Reviewed-by: Brian White <[email protected]>
Reviewed-by: Tommi <[email protected]>
Reviewed-by: Oskar Sundbom <[email protected]>
Commit-Queue: Henrik Grunell <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#618221}(cherry picked from commit 019922b)
Reviewed-on: https://chromium-review.googlesource.com/c/1388442
Reviewed-by: Henrik Grunell <[email protected]>
Cr-Commit-Position: refs/branch-heads/3626@{#498}
Cr-Branched-From: d897fb1-refs/heads/master@{#612437}
  • Loading branch information
Henrik Grunell committed Dec 21, 2018
1 parent 58e7b7e commit bd69979
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 2 deletions.
6 changes: 6 additions & 0 deletions chrome/browser/media/webrtc/webrtc_log_uploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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."));
Expand Down Expand Up @@ -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);
}
Expand Down
5 changes: 4 additions & 1 deletion chrome/browser/media/webrtc/webrtc_logging_handler_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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, "",
Expand Down
8 changes: 8 additions & 0 deletions chrome/browser/media/webrtc/webrtc_logging_handler_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
52 changes: 52 additions & 0 deletions tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53555,6 +53555,58 @@ Full version information for the fingerprint enum values:
<int value="1" label="Error"/>
</enum>

<enum name="WebRtcLoggingUploadFailureReason">
<summary>
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 &quot;HttpResponseCode&quot;.
</summary>
<int value="0" label="Invalid state"/>
<int value="1" label="Stored log not found"/>
<int value="100" label="100: Continue"/>
<int value="101" label="101: Switching Protocols"/>
<int value="102" label="102: Processing"/>
<int value="103" label="103: Early Hints"/>
<int value="201" label="201: Created"/>
<int value="202" label="202: Accepted"/>
<int value="203" label="203: Non-Authoritative Information"/>
<int value="204" label="204: No Content"/>
<int value="205" label="205: Reset Content"/>
<int value="206" label="206: Partial Content"/>
<int value="300" label="300: Multiple Choices"/>
<int value="301" label="301: Moved Permanently"/>
<int value="302" label="302: Found"/>
<int value="303" label="303: See Other"/>
<int value="304" label="304: Not Modified"/>
<int value="305" label="305: Use Proxy"/>
<int value="306" label="306: (Unused)"/>
<int value="307" label="307: Temporary Redirect"/>
<int value="400" label="400: Bad Request"/>
<int value="401" label="401: Unauthorized"/>
<int value="402" label="402: Payment Required"/>
<int value="403" label="403: Forbidden"/>
<int value="404" label="404: Not Found"/>
<int value="405" label="405: Method Not Allowed"/>
<int value="406" label="406: Not Acceptable"/>
<int value="407" label="407: Proxy Authentication Required"/>
<int value="408" label="408: Request Timeout"/>
<int value="409" label="409: Conflict"/>
<int value="410" label="410: Gone"/>
<int value="411" label="411: Length Required"/>
<int value="412" label="412: Precondition Failed"/>
<int value="413" label="413: Request Entity Too Large"/>
<int value="414" label="414: Request-URI Too Long"/>
<int value="415" label="415: Unsupported Media Type"/>
<int value="416" label="416: Requested Range Not Satisfiable"/>
<int value="417" label="417: Expectation Failed"/>
<int value="500" label="500: Internal Server Error"/>
<int value="501" label="501: Not Implemented"/>
<int value="502" label="502: Bad Gateway"/>
<int value="503" label="503: Service Unavailable"/>
<int value="504" label="504: Gateway Timeout"/>
<int value="505" label="505: HTTP Version Not Supported"/>
</enum>

<enum name="WebRtcLoggingWebAppIdHash">
<int value="-100222544" label="Hangouts"/>
<int value="0" label="Undefined"/>
Expand Down
11 changes: 10 additions & 1 deletion tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126349,14 +126349,23 @@ uploading your change for review.
</histogram>

<histogram base="true" name="WebRtcTextLogging"
enum="WebRtcLoggingWebAppIdHash">
enum="WebRtcLoggingWebAppIdHash" expires_after="2019-07-01">
<owner>[email protected]</owner>
<summary>
Counts the number of WebRTC text log events per web application. Suffixed by
event.
</summary>
</histogram>

<histogram name="WebRtcTextLogging.UploadFailureReason"
enum="WebRtcLoggingUploadFailureReason" expires_after="2019-07-01">
<owner>[email protected]</owner>
<summary>
Counts upload failures for WebRTC text log. Recorded when an upload attempt
fails.
</summary>
</histogram>

<histogram name="WebShare.ApiCount" enum="WebShareMethod">
<owner>[email protected]</owner>
<summary>
Expand Down

0 comments on commit bd69979

Please sign in to comment.