Bug 1898737 - Add telemetry for byte-range requests, and how often they're cacheable r=jesup,kershaw,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D212825
This commit is contained in:
Sean
2024-06-12 12:09:28 +00:00
parent ac6f31da0d
commit f8a45f5b05
2 changed files with 26 additions and 1 deletions

View File

@@ -56,6 +56,21 @@ netwerk:
expires: never
network:
byte_range_request:
type: labeled_counter
labels:
- cacheable
- not_cacheable
description: >
Counts of cacheable/non-cacheable byte-range requests
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1898737
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1898737
notification_emails:
- necko@mozilla.com
expires: never
data_size_per_type:
type: labeled_counter
labels:

View File

@@ -3749,7 +3749,17 @@ static bool IsSubRangeRequest(nsHttpRequestHead& aRequestHead) {
if (NS_FAILED(aRequestHead.GetHeader(nsHttp::Range, byteRange))) {
return false;
}
return !byteRange.EqualsLiteral("bytes=0-");
if (byteRange.EqualsLiteral("bytes=0-")) {
#ifndef ANDROID
glean::network::byte_range_request.Get("cacheable"_ns).Add(1);
#endif
return false;
}
#ifndef ANDROID
glean::network::byte_range_request.Get("not_cacheable"_ns).Add(1);
#endif
return true;
}
nsresult nsHttpChannel::OpenCacheEntry(bool isHttps) {