forked from mirrors/gecko-dev
Bug 1866245 - Record telemetry for how many DoH requests we make in private browsing r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D194498
This commit is contained in:
parent
476ac77038
commit
8d95b892ac
4 changed files with 60 additions and 1 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include "mozilla/UniquePtr.h"
|
||||
// Put DNSLogging.h at the end to avoid LOG being overwritten by other headers.
|
||||
#include "DNSLogging.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
|
@ -1006,6 +1007,13 @@ TRR::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
|
|||
channel.swap(mChannel);
|
||||
|
||||
mChannelStatus = aStatusCode;
|
||||
if (NS_SUCCEEDED(aStatusCode)) {
|
||||
nsCString label = "regular"_ns;
|
||||
if (mPB) {
|
||||
label = "private"_ns;
|
||||
}
|
||||
mozilla::glean::networking::trr_request_count.Get(label).Add(1);
|
||||
}
|
||||
|
||||
{
|
||||
// Cancel the timer since we don't need it anymore.
|
||||
|
|
|
|||
|
|
@ -577,3 +577,19 @@ networking:
|
|||
labels:
|
||||
- success
|
||||
- failure
|
||||
|
||||
trr_request_count:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
The count of successful TRR requests keyed by regular/private browsing
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1866245
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1866245
|
||||
notification_emails:
|
||||
- vgosu@mozilla.com
|
||||
- necko@mozilla.com
|
||||
expires: 130
|
||||
labels:
|
||||
- regular
|
||||
- private
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class TRRDNSListener {
|
|||
this.additionalInfo,
|
||||
this,
|
||||
currentThread,
|
||||
{} // defaultOriginAttributes
|
||||
this.options.originAttributes || {} // defaultOriginAttributes
|
||||
);
|
||||
Assert.ok(!this.options.expectEarlyFail, "asyncResolve ok");
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -909,3 +909,38 @@ add_task(async function test_padding() {
|
|||
});
|
||||
|
||||
add_task(test_connection_reuse_and_cycling);
|
||||
|
||||
// Can't test for socket process since telemetry is captured in different process.
|
||||
add_task(
|
||||
{ skip_if: () => mozinfo.socketprocess_networking },
|
||||
async function test_trr_pb_telemetry() {
|
||||
setModeAndURI(Ci.nsIDNSService.MODE_TRRONLY, `doh`);
|
||||
Services.dns.clearCache(true);
|
||||
Services.fog.initializeFOG();
|
||||
Services.fog.testResetFOG();
|
||||
await new TRRDNSListener("testytest.com", { expectedAnswer: "5.5.5.5" });
|
||||
|
||||
Assert.equal(
|
||||
await Glean.networking.trrRequestCount.regular.testGetValue(),
|
||||
2
|
||||
); // One for IPv4 and one for IPv6.
|
||||
Assert.equal(
|
||||
await Glean.networking.trrRequestCount.private.testGetValue(),
|
||||
null
|
||||
);
|
||||
|
||||
await new TRRDNSListener("testytest.com", {
|
||||
expectedAnswer: "5.5.5.5",
|
||||
originAttributes: { privateBrowsingId: 1 },
|
||||
});
|
||||
|
||||
Assert.equal(
|
||||
await Glean.networking.trrRequestCount.regular.testGetValue(),
|
||||
2
|
||||
);
|
||||
Assert.equal(
|
||||
await Glean.networking.trrRequestCount.private.testGetValue(),
|
||||
2
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue