зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543005 - Collect telemetry on traffic transferred through a captive portal. r=valentin
Adding telemetry for the amount of traffic transfer over the captive portal. Also moving some telemetry for trackers to the same place where our old telemetry is, so that they are all on the same place. Differential Revision: https://phabricator.services.mozilla.com/D27375 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cf3b264329
Коммит
a27692b748
|
@ -120,6 +120,8 @@ nsHttpConnection::nsHttpConnection()
|
|||
mIdleTimeout = (k5Sec < gHttpHandler->IdleTimeout())
|
||||
? k5Sec
|
||||
: gHttpHandler->IdleTimeout();
|
||||
|
||||
mThroughCaptivePortal = gHttpHandler->GetThroughCaptivePortal();
|
||||
}
|
||||
|
||||
nsHttpConnection::~nsHttpConnection() {
|
||||
|
@ -153,6 +155,20 @@ nsHttpConnection::~nsHttpConnection() {
|
|||
: Telemetry::HTTP_KBREAD_PER_CONN2,
|
||||
totalKBRead);
|
||||
}
|
||||
|
||||
if (mThroughCaptivePortal) {
|
||||
if (mTotalBytesRead || mTotalBytesWritten) {
|
||||
auto total = Clamp<uint32_t>(
|
||||
(mTotalBytesRead >> 10) + (mTotalBytesWritten >> 10), 0,
|
||||
std::numeric_limits<uint32_t>::max());
|
||||
Telemetry::ScalarAdd(
|
||||
Telemetry::ScalarID::NETWORKING_DATA_TRANSFERRED_CAPTIVE_PORTAL, total);
|
||||
}
|
||||
|
||||
Telemetry::ScalarAdd(
|
||||
Telemetry::ScalarID::NETWORKING_HTTP_CONNECTIONS_CAPTIVE_PORTAL, 1);
|
||||
}
|
||||
|
||||
if (mForceSendTimer) {
|
||||
mForceSendTimer->Cancel();
|
||||
mForceSendTimer = nullptr;
|
||||
|
|
|
@ -441,6 +441,7 @@ class nsHttpConnection final : public nsAHttpSegmentReader,
|
|||
bool mBootstrappedTimingsSet;
|
||||
|
||||
nsTArray<HttpTrafficCategory> mTrafficCategory;
|
||||
bool mThroughCaptivePortal;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsHttpConnection, NS_HTTPCONNECTION_IID)
|
||||
|
|
|
@ -307,7 +307,8 @@ nsHttpHandler::nsHttpHandler()
|
|||
mProcessId(0),
|
||||
mNextChannelId(1),
|
||||
mLastActiveTabLoadOptimizationLock(
|
||||
"nsHttpConnectionMgr::LastActiveTabLoadOptimization") {
|
||||
"nsHttpConnectionMgr::LastActiveTabLoadOptimization"),
|
||||
mThroughCaptivePortal(false) {
|
||||
LOG(("Creating nsHttpHandler [this=%p].\n", this));
|
||||
|
||||
mUserAgentOverride.SetIsVoid(true);
|
||||
|
@ -567,6 +568,7 @@ nsresult nsHttpHandler::Init() {
|
|||
obsService->AddObserver(this, "psm:user-certificate-deleted", true);
|
||||
obsService->AddObserver(this, "intl:app-locales-changed", true);
|
||||
obsService->AddObserver(this, "browser-delayed-startup-finished", true);
|
||||
obsService->AddObserver(this, "network:captive-portal-connectivity", true);
|
||||
|
||||
if (!IsNeckoChild()) {
|
||||
obsService->AddObserver(
|
||||
|
@ -2338,6 +2340,9 @@ nsHttpHandler::Observe(nsISupports *subject, const char *topic,
|
|||
mAcceptLanguagesIsDirty = true;
|
||||
} else if (!strcmp(topic, "browser-delayed-startup-finished")) {
|
||||
MaybeEnableSpeculativeConnect();
|
||||
} else if (!strcmp(topic, "network:captive-portal-connectivity")) {
|
||||
nsAutoCString data8 = NS_ConvertUTF16toUTF8(data);
|
||||
mThroughCaptivePortal = data8.EqualsLiteral("captive");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -422,6 +422,7 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
|
|||
|
||||
HttpTrafficAnalyzer *GetHttpTrafficAnalyzer();
|
||||
|
||||
bool GetThroughCaptivePortal() { return mThroughCaptivePortal; }
|
||||
private:
|
||||
nsHttpHandler();
|
||||
|
||||
|
@ -737,6 +738,8 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
|
|||
|
||||
private:
|
||||
nsTHashtable<nsCStringHashKey> mBlacklistedSpdyOrigins;
|
||||
|
||||
bool mThroughCaptivePortal;
|
||||
};
|
||||
|
||||
extern StaticRefPtr<nsHttpHandler> gHttpHandler;
|
||||
|
|
|
@ -158,6 +158,8 @@ nsHttpTransaction::nsHttpTransaction()
|
|||
#endif
|
||||
mSelfAddr.raw.family = PR_AF_UNSPEC;
|
||||
mPeerAddr.raw.family = PR_AF_UNSPEC;
|
||||
|
||||
mThroughCaptivePortal = gHttpHandler->GetThroughCaptivePortal();
|
||||
}
|
||||
|
||||
void nsHttpTransaction::ResumeReading() {
|
||||
|
@ -1196,6 +1198,11 @@ void nsHttpTransaction::Close(nsresult reason) {
|
|||
}
|
||||
}
|
||||
|
||||
if (mThroughCaptivePortal) {
|
||||
Telemetry::ScalarAdd(
|
||||
Telemetry::ScalarID::NETWORKING_HTTP_TRANSACTIONS_CAPTIVE_PORTAL, 1);
|
||||
}
|
||||
|
||||
if (relConn && mConnection) {
|
||||
MutexAutoLock lock(mLock);
|
||||
mConnection = nullptr;
|
||||
|
|
|
@ -484,6 +484,7 @@ class nsHttpTransaction final : public nsAHttpTransaction,
|
|||
RefPtr<SpdyConnectTransaction> mH2WSTransaction;
|
||||
|
||||
HttpTrafficCategory mTrafficCategory;
|
||||
bool mThroughCaptivePortal;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -3614,6 +3614,45 @@ networking:
|
|||
record_in_processes:
|
||||
- 'main'
|
||||
|
||||
data_transferred_captive_portal:
|
||||
bug_numbers:
|
||||
- 1543005
|
||||
description: >
|
||||
Hom many KB has been transfer over a captive portal during a subsession.
|
||||
expires: "73"
|
||||
keyed: false
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- ddamjanovic@mozilla.com
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
|
||||
http_transactions_captive_portal:
|
||||
bug_numbers:
|
||||
- 1543005
|
||||
description: >
|
||||
Number of http transactions transfer over a captive portal during a subsession.
|
||||
expires: "73"
|
||||
keyed: false
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- ddamjanovic@mozilla.com
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
|
||||
http_connections_captive_portal:
|
||||
bug_numbers:
|
||||
- 1543005
|
||||
description: >
|
||||
Number of http connections transfer over a captive portal during a subsession.
|
||||
expires: "73"
|
||||
keyed: false
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- ddamjanovic@mozilla.com
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
|
||||
# The following section is for probes testing the Telemetry system. They will not be
|
||||
# submitted in pings and are only used for testing.
|
||||
telemetry.test:
|
||||
|
|
Загрузка…
Ссылка в новой задаче