Bug 1460314 - TRR: add telemetry probe for used HTTP version. r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D100519
This commit is contained in:
Nihanth Subramanya 2021-02-22 14:43:15 +00:00
parent b6962abbfe
commit b88988a027
2 changed files with 34 additions and 0 deletions

View file

@ -882,6 +882,28 @@ void TRR::ReportStatus(nsresult aStatusCode) {
}
}
static void RecordHttpVersion(nsIHttpChannel* aHttpChannel) {
nsAutoCString protocol;
nsresult rv = aHttpChannel->GetProtocolVersion(protocol);
if (NS_FAILED(rv)) {
LOG(("Failed to get protocol version, rv=%x", (int)rv));
return;
}
if (protocol.LowerCaseEqualsLiteral("h2")) {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_DNS_TRR_HTTP_VERSION::h_2);
} else if (protocol.LowerCaseEqualsLiteral("h3")) {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_DNS_TRR_HTTP_VERSION::h_3);
} else {
Telemetry::AccumulateCategorical(
Telemetry::LABELS_DNS_TRR_HTTP_VERSION::h_1);
}
LOG(("DoH endpoint responded using HTTP version: %s", protocol.get()));
}
NS_IMETHODIMP
TRR::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
// The dtor will be run after the function returns
@ -927,6 +949,7 @@ TRR::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
if (NS_SUCCEEDED(rv) && UseDefaultServer()) {
RecordReason(nsHostRecord::TRR_OK);
RecordProcessingTime(channel);
RecordHttpVersion(httpChannel);
return rv;
}
} else {

View file

@ -4220,6 +4220,17 @@
"n_buckets": 50,
"description": "Time from the last received byte of the response until we have notified the consumer with a DNS record (msec)"
},
"DNS_TRR_HTTP_VERSION": {
"record_in_processes": ["main"],
"products": ["firefox"],
"expires_in_version": "never",
"kind": "categorical",
"labels": ["h_1", "h_2", "h_3"],
"releaseChannelCollection": "opt-out",
"alert_emails": ["nhnt11@mozilla.com", "necko@mozilla.com"],
"bug_numbers": [1460314],
"description": "HTTP version used by DoH endpoint"
},
"DNS_NATIVE_LOOKUP_TIME": {
"record_in_processes": ["main"],
"products": ["firefox", "fennec"],