bug 1470853 - Add Telemetry::DNS_TRR_REQUEST_PER_CONN r=nwgh

Count number of requests/streams per connection done when the connection
was used for TRR.

MozReview-Commit-ID: H7X06h8gVZY

Differential Revision: https://phabricator.services.mozilla.com/D3589

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daniel Stenberg 2018-08-20 15:11:14 +00:00
Родитель 4b85350209
Коммит 70b6a3456b
7 изменённых файлов: 42 добавлений и 0 удалений

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

@ -121,6 +121,7 @@ Http2Session::Http2Session(nsISocketTransport *aSocketTransport, enum SpdyVersio
, mTlsHandshakeFinished(false)
, mCheckNetworkStallsWithTFO(false)
, mLastRequestBytesSentTime(0)
, mTrrStreams(0)
{
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
@ -179,6 +180,9 @@ Http2Session::~Http2Session()
Shutdown();
if (mTrrStreams) {
Telemetry::Accumulate(Telemetry::DNS_TRR_REQUEST_PER_CONN, mTrrStreams);
}
Telemetry::Accumulate(Telemetry::SPDY_PARALLEL_STREAMS, mConcurrentHighWater);
Telemetry::Accumulate(Telemetry::SPDY_REQUEST_PER_CONN, (mNextStreamID - 1) / 2);
Telemetry::Accumulate(Telemetry::SPDY_SERVER_INITIATED_STREAMS,
@ -400,6 +404,13 @@ Http2Session::RegisterStreamID(Http2Stream *stream, uint32_t aNewID)
mLastRequestBytesSentTime = PR_IntervalNow();
}
}
MOZ_ASSERT(stream->Transaction(), "no transation for the stream!");
RefPtr<nsHttpConnectionInfo> ci(stream->Transaction()->ConnectionInfo());
if (ci && ci->GetTrrUsed()) {
mTrrStreams++;
}
return aNewID;
}

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

@ -574,6 +574,7 @@ private:
void UnRegisterTunnel(Http2Stream *);
uint32_t FindTunnelCount(nsHttpConnectionInfo *);
nsDataHashtable<nsCStringHashKey, uint32_t> mTunnelHash;
uint32_t mTrrStreams;
};
} // namespace net

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

@ -571,6 +571,7 @@ nsHttpChannel::OnBeforeConnect()
mConnectionInfo->SetNoSpdy(mCaps & NS_HTTP_DISALLOW_SPDY);
mConnectionInfo->SetBeConservative((mCaps & NS_HTTP_BE_CONSERVATIVE) || mBeConservative);
mConnectionInfo->SetTlsFlags(mTlsFlags);
mConnectionInfo->SetTrrUsed(mTRR);
// notify "http-on-before-connect" observers
gHttpHandler->OnBeforeConnect(this);

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

@ -123,6 +123,19 @@ nsHttpConnection::~nsHttpConnection()
this, mHttp1xTransactionCount));
Telemetry::Accumulate(Telemetry::HTTP_REQUEST_PER_CONN,
mHttp1xTransactionCount);
nsHttpConnectionInfo *ci = nullptr;
if (mTransaction) {
ci = mTransaction->ConnectionInfo();
}
if (!ci) {
ci = mConnInfo;
}
MOZ_ASSERT(ci);
if (ci->GetTrrUsed()) {
Telemetry::Accumulate(Telemetry::DNS_TRR_REQUEST_PER_CONN,
mHttp1xTransactionCount);
}
}
if (mTotalBytesRead) {

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

@ -89,6 +89,7 @@ nsHttpConnectionInfo::Init(const nsACString &host, int32_t port,
mNPNToken = npnToken;
mOriginAttributes = originAttributes;
mTlsFlags = 0x0;
mTrrUsed = false;
mUsingHttpsProxy = (proxyInfo && proxyInfo->IsHTTPS());
mUsingHttpProxy = mUsingHttpsProxy || (proxyInfo && proxyInfo->IsHTTP());
@ -242,6 +243,7 @@ nsHttpConnectionInfo::Clone() const
clone->SetNoSpdy(GetNoSpdy());
clone->SetBeConservative(GetBeConservative());
clone->SetTlsFlags(GetTlsFlags());
clone->SetTrrUsed(GetTrrUsed());
MOZ_ASSERT(clone->Equals(this));
return clone;

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

@ -120,6 +120,9 @@ public:
void SetTlsFlags(uint32_t aTlsFlags);
uint32_t GetTlsFlags() const { return mTlsFlags; }
void SetTrrUsed(bool aUsed) { mTrrUsed = aUsed; }
bool GetTrrUsed() const { return mTrrUsed; }
const nsCString &GetNPNToken() { return mNPNToken; }
const nsCString &GetUsername() { return mUsername; }
@ -172,6 +175,7 @@ private:
OriginAttributes mOriginAttributes;
uint32_t mTlsFlags;
uint16_t mTrrUsed : 1;
// for RefPtr
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsHttpConnectionInfo, override)

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

@ -3330,6 +3330,16 @@
"bug_numbers": [1453825],
"alert_emails": ["necko@mozilla.com", "dstenberg@mozilla.com"]
},
"DNS_TRR_REQUEST_PER_CONN": {
"record_in_processes": ["main", "content"],
"alert_emails": ["necko@mozilla.com", "dstenberg@mozilla.com"],
"expires_in_version": "never",
"kind": "exponential",
"high": 5000,
"n_buckets": 100,
"bug_numbers": [1470853],
"description": "Number of DOH requests per connection"
},
"DNS_LOOKUP_ALGORITHM": {
"record_in_processes": ["main"],
"alert_emails": ["necko@mozilla.com", "dstenberg@mozilla.com"],