зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1914129 - Add telemetry for system channel failures keyed by failure type r=kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D219754
This commit is contained in:
Родитель
01690ae687
Коммит
fcee79d28c
|
@ -305,3 +305,55 @@ network:
|
|||
- necko@mozilla.com
|
||||
- vgosu@mozilla.com
|
||||
expires: never
|
||||
|
||||
system_channel_success_or_failure: &system_channel_success_or_failure
|
||||
type: labeled_counter
|
||||
description: >
|
||||
Counts the number of succeeded and failed channels with a system principal to a mozilla domain. Label contains ok or failure reason.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/1914129
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1914129
|
||||
notification_emails:
|
||||
- necko@mozilla.com
|
||||
- vgosu@mozilla.com
|
||||
expires: never
|
||||
labels:
|
||||
- ok
|
||||
- offline
|
||||
- connectivity
|
||||
- dns
|
||||
- connect_fail
|
||||
- tls_fail
|
||||
- http_status
|
||||
- cancel
|
||||
- timeout
|
||||
- reset
|
||||
- refused
|
||||
- partial
|
||||
- other
|
||||
|
||||
system_channel_update_status:
|
||||
<<: *system_channel_success_or_failure
|
||||
description: >
|
||||
Counts the status of succeeded and failed requests to aus5.mozilla.org
|
||||
|
||||
system_channel_addon_status:
|
||||
<<: *system_channel_success_or_failure
|
||||
description: >
|
||||
Counts the status of succeeded and failed requests to .addons.mozilla.org
|
||||
|
||||
system_channel_remote_settings_status:
|
||||
<<: *system_channel_success_or_failure
|
||||
description: >
|
||||
Counts the status of succeeded and failed requests to firefox.settings.services.mozilla.com
|
||||
|
||||
system_channel_telemetry_status:
|
||||
<<: *system_channel_success_or_failure
|
||||
description: >
|
||||
Counts the status of succeeded and failed requests to incoming.telemetry.mozilla.org
|
||||
|
||||
system_channel_other_status:
|
||||
<<: *system_channel_success_or_failure
|
||||
description: >
|
||||
Counts the status of succeeded and failed requests to other mozilla.org domains
|
||||
|
|
|
@ -8279,6 +8279,10 @@ nsHttpChannel::OnStopRequest(nsIRequest* request, nsresult status) {
|
|||
// completed.
|
||||
if (mCanceled || NS_FAILED(mStatus)) status = mStatus;
|
||||
|
||||
if (mLoadInfo->TriggeringPrincipal()->IsSystemPrincipal()) {
|
||||
ReportSystemChannelTelemetry(status);
|
||||
}
|
||||
|
||||
if (LoadCachedContentIsPartial()) {
|
||||
if (NS_SUCCEEDED(status)) {
|
||||
// mTransactionPump should be suspended
|
||||
|
@ -10357,6 +10361,97 @@ void nsHttpChannel::ReportNetVSCacheTelemetry() {
|
|||
}
|
||||
}
|
||||
|
||||
void nsHttpChannel::ReportSystemChannelTelemetry(nsresult status) {
|
||||
// Use status and httpStatus to determine
|
||||
// if it was successful, and if we had connectivity / offline in this time
|
||||
nsAutoCString domain;
|
||||
mOriginalURI->GetHost(domain);
|
||||
|
||||
if (!LoadUsedNetwork()) {
|
||||
// We're not really interested in any cached requests.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!StringEndsWith(domain, ".mozilla.org"_ns) &&
|
||||
!StringEndsWith(domain, ".mozilla.com"_ns)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto hasConnectivity = []() -> bool {
|
||||
if (RefPtr<NetworkConnectivityService> ncs =
|
||||
NetworkConnectivityService::GetSingleton()) {
|
||||
nsINetworkConnectivityService::ConnectivityState state;
|
||||
if (NS_SUCCEEDED(ncs->GetIPv4(&state)) &&
|
||||
state == nsINetworkConnectivityService::NOT_AVAILABLE &&
|
||||
NS_SUCCEEDED(ncs->GetIPv6(&state)) &&
|
||||
state == nsINetworkConnectivityService::NOT_AVAILABLE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
nsAutoCString label("ok"_ns);
|
||||
if (NS_FAILED(status)) {
|
||||
if (mCanceled) {
|
||||
// The request was cancelled.
|
||||
label = "cancel"_ns;
|
||||
} else if (NS_IsOffline()) {
|
||||
// The error occured while all interfaces are offline
|
||||
label = "offline"_ns;
|
||||
} else if (!hasConnectivity()) {
|
||||
// The error occured while the browser didn't have connectivity
|
||||
label = "connectivity"_ns;
|
||||
} else if (status == NS_ERROR_UNKNOWN_HOST) {
|
||||
// The failure was a DNS error
|
||||
label = "dns"_ns;
|
||||
} else if (NS_ERROR_GET_MODULE(status) == NS_ERROR_MODULE_SECURITY) {
|
||||
// The error was due to TLS
|
||||
label = "tls_fail"_ns;
|
||||
} else if (status == NS_ERROR_NET_RESET) {
|
||||
label = "reset"_ns;
|
||||
} else if (status == NS_ERROR_NET_TIMEOUT) {
|
||||
label = "timeout"_ns;
|
||||
} else if (status == NS_ERROR_CONNECTION_REFUSED) {
|
||||
label = "refused"_ns;
|
||||
} else if (status == NS_ERROR_NET_PARTIAL_TRANSFER) {
|
||||
label = "partial"_ns;
|
||||
} else {
|
||||
// Unspecified error. If this bucket is too big we might add other labels.
|
||||
label = "other"_ns;
|
||||
}
|
||||
} else if (mResponseHead && mResponseHead->Status() / 100 != 2) {
|
||||
// There was no channel error, but the server responded with a non-2XX
|
||||
// status code.
|
||||
label = "http_status";
|
||||
}
|
||||
|
||||
if (StringEndsWith(domain, ".addons.mozilla.org"_ns)) {
|
||||
mozilla::glean::network::system_channel_addon_status.Get(label).Add(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (domain == "aus5.mozilla.org"_ns) {
|
||||
mozilla::glean::network::system_channel_update_status.Get(label).Add(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (domain == "firefox.settings.services.mozilla.com"_ns) {
|
||||
mozilla::glean::network::system_channel_remote_settings_status.Get(label)
|
||||
.Add(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (domain == "incoming.telemetry.mozilla.com"_ns) {
|
||||
mozilla::glean::network::system_channel_telemetry_status.Get(label).Add(1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Not one of the probes we recorded earlier.
|
||||
mozilla::glean::network::system_channel_other_status.Get(label).Add(1);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::Test_delayCacheEntryOpeningBy(int32_t aTimeout) {
|
||||
LOG(("nsHttpChannel::Test_delayCacheEntryOpeningBy this=%p timeout=%d", this,
|
||||
|
|
|
@ -489,6 +489,8 @@ class nsHttpChannel final : public HttpBaseChannel,
|
|||
void ReportNetVSCacheTelemetry();
|
||||
int64_t ComputeTelemetryBucketNumber(int64_t difftime_ms);
|
||||
|
||||
// Report telemetry for system principal request success rate
|
||||
void ReportSystemChannelTelemetry(nsresult status);
|
||||
// Report telemetry and stats to about:networking
|
||||
void ReportRcwnStats(bool isFromNet);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче