Bug 1799727: Add redirection time, redirection count, http protocol, trr domain, and same site navigation boolean to the page load event r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D161643
This commit is contained in:
Denis Palmeiro 2022-12-15 20:19:52 +00:00
Родитель 335c4ba85b
Коммит cb098267e2
3 изменённых файлов: 72 добавлений и 1 удалений

Просмотреть файл

@ -2041,6 +2041,23 @@ void Document::RecordPageLoadEventTelemetry(
break;
}
nsCOMPtr<nsIEffectiveTLDService> tldService =
do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
if (tldService && mReferrerInfo &&
(docshell->GetLoadType() & nsIDocShell::LOAD_CMD_NORMAL)) {
nsAutoCString currentBaseDomain, referrerBaseDomain;
nsCOMPtr<nsIURI> referrerURI = mReferrerInfo->GetComputedReferrer();
if (referrerURI) {
auto result = NS_SUCCEEDED(
tldService->GetBaseDomain(referrerURI, 0, referrerBaseDomain));
if (result) {
bool sameOrigin = false;
NodePrincipal()->IsSameOrigin(referrerURI, &sameOrigin);
aEventTelemetryData.sameOriginNav = mozilla::Some(sameOrigin);
}
}
}
aEventTelemetryData.loadType = mozilla::Some(loadTypeStr);
// Sending a glean ping must be done on the parent process.
@ -2071,6 +2088,22 @@ void Document::AccumulatePageLoadTelemetry(
TimeStamp responseStart;
timedChannel->GetResponseStart(&responseStart);
TimeStamp redirectStart, redirectEnd;
timedChannel->GetRedirectStart(&redirectStart);
timedChannel->GetRedirectEnd(&redirectEnd);
uint8_t redirectCount;
timedChannel->GetRedirectCount(&redirectCount);
if (redirectCount) {
aEventTelemetryDataOut.redirectCount =
mozilla::Some(static_cast<uint32_t>(redirectCount));
}
if (!redirectStart.IsNull() && !redirectEnd.IsNull()) {
aEventTelemetryDataOut.redirectTime = mozilla::Some(
static_cast<uint32_t>((redirectEnd - redirectStart).ToMilliseconds()));
}
TimeStamp navigationStart =
GetNavigationTiming()->GetNavigationStartTimeStamp();
@ -2090,6 +2123,7 @@ void Document::AccumulatePageLoadTelemetry(
RefPtr<net::ChildDNSService> dnsServiceChild =
net::ChildDNSService::GetSingleton();
dnsServiceChild->GetTRRDomain(dnsKey);
aEventTelemetryDataOut.trrDomain = mozilla::Some(dnsKey);
}
uint32_t major;
@ -2116,6 +2150,8 @@ void Document::AccumulatePageLoadTelemetry(
http3Key = "supports_http3"_ns;
}
}
aEventTelemetryDataOut.httpVer = mozilla::Some(major);
}
}

Просмотреть файл

@ -22,6 +22,11 @@ struct ParamTraits<mozilla::glean::perf::PageLoadExtra> {
WriteParam(aWriter, aParam.loadTime);
WriteParam(aWriter, aParam.loadType);
WriteParam(aWriter, aParam.responseTime);
WriteParam(aWriter, aParam.httpVer);
WriteParam(aWriter, aParam.redirectCount);
WriteParam(aWriter, aParam.redirectTime);
WriteParam(aWriter, aParam.sameOriginNav);
WriteParam(aWriter, aParam.trrDomain);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
@ -29,7 +34,12 @@ struct ParamTraits<mozilla::glean::perf::PageLoadExtra> {
ReadParam(aReader, &aResult->jsExecTime) &&
ReadParam(aReader, &aResult->loadTime) &&
ReadParam(aReader, &aResult->loadType) &&
ReadParam(aReader, &aResult->responseTime);
ReadParam(aReader, &aResult->responseTime) &&
ReadParam(aReader, &aResult->httpVer) &&
ReadParam(aReader, &aResult->redirectCount) &&
ReadParam(aReader, &aResult->redirectTime) &&
ReadParam(aReader, &aResult->sameOriginNav) &&
ReadParam(aReader, &aResult->trrDomain);
}
};

Просмотреть файл

@ -17,8 +17,10 @@ perf:
Recorded when a top level content document has been loaded.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1759744
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799727
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1759744#c5
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799727#c4
notification_emails:
- perf-telemetry-alerts@mozilla.com
- dpalmeiro@mozilla.com
@ -44,9 +46,32 @@ perf:
"Time spent executing JS during page load, in ms."
type: quantity
unit: ms
redirect_time:
type: quantity
description:
"Time spent in redirections for the top level document."
unit: ms
redirect_count:
description:
"Number of redirections for the top level document."
type: quantity
unit: integer
load_type:
description:
"One of normal,reload,stop,link,history,error or other."
type: string
same_origin_nav:
description:
"If true, a normal navigation was performed on the same origin."
type: boolean
http_ver:
description:
"Version of HTTP protocol used."
type: quantity
unit: integer
trr_domain:
description:
"TRR domain used."
type: string
send_in_pings:
- pageload