Bug 1819336: Collect Telemetry to compare success rate of regular image, video, audio loads and upgraded image, video, audio loads, r=freddyb

Differential Revision: https://phabricator.services.mozilla.com/D171460
This commit is contained in:
Christoph Kerschbaumer 2023-03-07 10:29:39 +00:00
parent b340c8b127
commit 2f23427949
2 changed files with 78 additions and 0 deletions

View File

@ -7768,6 +7768,54 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
}
}
// Collect specific telemetry for measuring image, video, audio
// success/failure rates in regular browsing mode and when auto upgrading of
// subresources is enabled. Note that we only evaluate actual image types, not
// favicons.
nsContentPolicyType internalLoadType;
mLoadInfo->GetInternalContentPolicyType(&internalLoadType);
bool statusIsSuccess = NS_SUCCEEDED(aStatus);
if (internalLoadType == nsIContentPolicy::TYPE_INTERNAL_IMAGE ||
internalLoadType == nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD) {
if (mLoadInfo->GetBrowserDidUpgradeInsecureRequests()) {
Telemetry::AccumulateCategorical(
statusIsSuccess
? Telemetry::LABELS_MIXED_CONTENT_IMAGES::ImgUpSuccess
: Telemetry::LABELS_MIXED_CONTENT_IMAGES::ImgUpFailure);
} else {
Telemetry::AccumulateCategorical(
statusIsSuccess
? Telemetry::LABELS_MIXED_CONTENT_IMAGES::ImgNoUpSuccess
: Telemetry::LABELS_MIXED_CONTENT_IMAGES::ImgNoUpFailure);
}
}
if (internalLoadType == nsIContentPolicy::TYPE_INTERNAL_VIDEO) {
if (mLoadInfo->GetBrowserDidUpgradeInsecureRequests()) {
Telemetry::AccumulateCategorical(
statusIsSuccess
? Telemetry::LABELS_MIXED_CONTENT_VIDEO::VideoUpSuccess
: Telemetry::LABELS_MIXED_CONTENT_VIDEO::VideoUpFailure);
} else {
Telemetry::AccumulateCategorical(
statusIsSuccess
? Telemetry::LABELS_MIXED_CONTENT_VIDEO::VideoNoUpSuccess
: Telemetry::LABELS_MIXED_CONTENT_VIDEO::VideoNoUpFailure);
}
}
if (internalLoadType == nsIContentPolicy::TYPE_INTERNAL_AUDIO) {
if (mLoadInfo->GetBrowserDidUpgradeInsecureRequests()) {
Telemetry::AccumulateCategorical(
statusIsSuccess
? Telemetry::LABELS_MIXED_CONTENT_AUDIO::AudioUpSuccess
: Telemetry::LABELS_MIXED_CONTENT_AUDIO::AudioUpFailure);
} else {
Telemetry::AccumulateCategorical(
statusIsSuccess
? Telemetry::LABELS_MIXED_CONTENT_AUDIO::AudioNoUpSuccess
: Telemetry::LABELS_MIXED_CONTENT_AUDIO::AudioNoUpFailure);
}
}
// if needed, check cache entry has all data we expect
if (mCacheEntry && mCachePump && LoadConcurrentCacheAccess() &&
aContentComplete) {

View File

@ -12362,6 +12362,36 @@
"kind": "boolean",
"description": "Accumulates how many downloads are mixed-content (True = The download is MixedContent, False= is not MixedContent)"
},
"MIXED_CONTENT_IMAGES": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],
"bug_numbers": [1819336],
"alert_emails": ["seceng-telemetry@mozilla.com"],
"expires_in_version": "never",
"kind": "categorical",
"labels": ["ImgUpSuccess", "ImgUpFailure", "ImgNoUpSuccess", "ImgNoUpFailure"],
"description": "How often image loads fail in regular mode and in upgrading mode?"
},
"MIXED_CONTENT_VIDEO": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],
"bug_numbers": [1819336],
"alert_emails": ["seceng-telemetry@mozilla.com"],
"expires_in_version": "never",
"kind": "categorical",
"labels": ["VideoUpSuccess", "VideoUpFailure", "VideoNoUpSuccess", "VideoNoUpFailure"],
"description": "How often video loads fail in regular mode and in upgrading mode?"
},
"MIXED_CONTENT_AUDIO": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],
"bug_numbers": [1819336],
"alert_emails": ["seceng-telemetry@mozilla.com"],
"expires_in_version": "never",
"kind": "categorical",
"labels": ["AudioUpSuccess", "AudioUpFailure", "AudioNoUpSuccess", "AudioNoUpFailure"],
"description": "How often audio loads fail in regular mode and in upgrading mode?"
},
"CONTENT_SIGNATURE_VERIFICATION_STATUS": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec", "thunderbird"],