bug 1470853 - Add Telemetry::DNS_TRR_REQUEST_PER_CONN r=nwgh
☠☠ backed out by 34c207093ab6 ☠ ☠
authorDaniel Stenberg <daniel@haxx.se>
Mon, 20 Aug 2018 15:11:14 +0000
changeset 490100 89117b6b5799666c38926cd566f230e19b050528
parent 490099 1906a8b16d63c4eae48b1f59bbaf0994eac35658
child 490101 54da55f0f79661cca9cf51278b0ab520c0772796
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnwgh
bugs1470853
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
netwerk/protocol/http/Http2Session.cpp
netwerk/protocol/http/Http2Session.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnectionInfo.cpp
netwerk/protocol/http/nsHttpConnectionInfo.h
toolkit/components/telemetry/Histograms.json
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -116,16 +116,17 @@ Http2Session::Http2Session(nsISocketTran
   , mWaitingForSettingsAck(false)
   , mGoAwayOnPush(false)
   , mUseH2Deps(false)
   , mAttemptingEarlyData(attemptingEarlyData)
   , mOriginFrameActivated(false)
   , mTlsHandshakeFinished(false)
   , mCheckNetworkStallsWithTFO(false)
   , mLastRequestBytesSentTime(0)
+  , mTrrStreams(0)
 {
   MOZ_ASSERT(OnSocketThread(), "not on socket thread");
 
   static uint64_t sSerial;
   mSerial = ++sSerial;
 
   LOG3(("Http2Session::Http2Session %p serial=0x%" PRIX64 "\n", this, mSerial));
 
@@ -174,16 +175,19 @@ Http2Session::Shutdown()
 
 Http2Session::~Http2Session()
 {
   LOG3(("Http2Session::~Http2Session %p mDownstreamState=%X",
         this, mDownstreamState));
 
   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,
                         mServerPushedResources);
   Telemetry::Accumulate(Telemetry::SPDY_GOAWAY_LOCAL, mClientGoAwayReason);
   Telemetry::Accumulate(Telemetry::SPDY_GOAWAY_PEER, mPeerGoAwayReason);
 }
 
@@ -395,16 +399,23 @@ Http2Session::RegisterStreamID(Http2Stre
         gHttpHandler->CheckIfConnectionIsStalledOnlyIfIdleForThisAmountOfSeconds() &&
         IdleTime() >= gHttpHandler->CheckIfConnectionIsStalledOnlyIfIdleForThisAmountOfSeconds()) {
       // If a connection was using the TCP FastOpen and it was idle for a
       // long time we should check for stalls like bug 1395494.
       mCheckNetworkStallsWithTFO = true;
       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;
 }
 
 bool
 Http2Session::AddStream(nsAHttpTransaction *aHttpTransaction,
                         int32_t aPriority,
                         bool aUseTunnel,
                         nsIInterfaceRequestor *aCallbacks)
--- a/netwerk/protocol/http/Http2Session.h
+++ b/netwerk/protocol/http/Http2Session.h
@@ -569,14 +569,15 @@ private:
 private:
 /// connect tunnels
   void DispatchOnTunnel(nsAHttpTransaction *, nsIInterfaceRequestor *);
   void CreateTunnel(nsHttpTransaction *, nsHttpConnectionInfo *, nsIInterfaceRequestor *);
   void RegisterTunnel(Http2Stream *);
   void UnRegisterTunnel(Http2Stream *);
   uint32_t FindTunnelCount(nsHttpConnectionInfo *);
   nsDataHashtable<nsCStringHashKey, uint32_t> mTunnelHash;
+  uint32_t mTrrStreams;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_Http2Session_h
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -566,16 +566,17 @@ nsHttpChannel::OnBeforeConnect()
     }
 
     // Finalize ConnectionInfo flags before SpeculativeConnect
     mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0);
     mConnectionInfo->SetPrivate(mPrivateBrowsing);
     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);
 
     // Check if request was cancelled during http-on-before-connect.
     if (mCanceled) {
         return mStatus;
     }
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -118,16 +118,29 @@ nsHttpConnection::~nsHttpConnection()
 {
     LOG(("Destroying nsHttpConnection @%p\n", this));
 
     if (!mEverUsedSpdy) {
         LOG(("nsHttpConnection %p performed %d HTTP/1.x transactions\n",
              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) {
         uint32_t totalKBRead = static_cast<uint32_t>(mTotalBytesRead >> 10);
         LOG(("nsHttpConnection %p read %dkb on connection spdy=%d\n",
              this, totalKBRead, mEverUsedSpdy));
         Telemetry::Accumulate(mEverUsedSpdy ?
                               Telemetry::SPDY_KBREAD_PER_CONN :
--- a/netwerk/protocol/http/nsHttpConnectionInfo.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.cpp
@@ -84,16 +84,17 @@ nsHttpConnectionInfo::Init(const nsACStr
 
     mUsername = username;
     mProxyInfo = proxyInfo;
     mEndToEndSSL = e2eSSL;
     mUsingConnect = false;
     mNPNToken = npnToken;
     mOriginAttributes = originAttributes;
     mTlsFlags = 0x0;
+    mTrrUsed = false;
 
     mUsingHttpsProxy = (proxyInfo && proxyInfo->IsHTTPS());
     mUsingHttpProxy = mUsingHttpsProxy || (proxyInfo && proxyInfo->IsHTTP());
 
     if (mUsingHttpProxy) {
         mUsingConnect = mEndToEndSSL;  // SSL always uses CONNECT
         uint32_t resolveFlags = 0;
         if (NS_SUCCEEDED(mProxyInfo->GetResolveFlags(&resolveFlags)) &&
@@ -237,16 +238,17 @@ nsHttpConnectionInfo::Clone() const
 
     // Make sure the anonymous, insecure-scheme, and private flags are transferred
     clone->SetAnonymous(GetAnonymous());
     clone->SetPrivate(GetPrivate());
     clone->SetInsecureScheme(GetInsecureScheme());
     clone->SetNoSpdy(GetNoSpdy());
     clone->SetBeConservative(GetBeConservative());
     clone->SetTlsFlags(GetTlsFlags());
+    clone->SetTrrUsed(GetTrrUsed());
     MOZ_ASSERT(clone->Equals(this));
 
     return clone;
 }
 
 void
 nsHttpConnectionInfo::CloneAsDirectRoute(nsHttpConnectionInfo **outCI)
 {
--- a/netwerk/protocol/http/nsHttpConnectionInfo.h
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.h
@@ -115,16 +115,19 @@ public:
 
     void          SetBeConservative(bool aBeConservative)
                                             { mHashKey.SetCharAt(aBeConservative ? 'C' : '.', 6); }
     bool          GetBeConservative() const { return mHashKey.CharAt(6) == 'C'; }
 
     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; }
 
     const OriginAttributes &GetOriginAttributes() { return mOriginAttributes; }
 
     // Returns true for any kind of proxy (http, socks, https, etc..)
     bool UsingProxy();
 
@@ -167,16 +170,17 @@ private:
     bool                   mUsingHttpProxy;
     bool                   mUsingHttpsProxy;
     bool                   mEndToEndSSL;
     bool                   mUsingConnect;  // if will use CONNECT with http proxy
     nsCString              mNPNToken;
     OriginAttributes       mOriginAttributes;
 
     uint32_t               mTlsFlags;
+    uint16_t               mTrrUsed : 1;
 
 // for RefPtr
     NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsHttpConnectionInfo, override)
 };
 
 } // namespace net
 } // namespace mozilla
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3325,16 +3325,26 @@
   "DNS_TRR_NS_VERFIFIED": {
     "record_in_processes": ["main"],
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "TRR managed to verify NS entry",
     "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"],
     "expires_in_version": "never",
     "kind": "categorical",
     "labels": ["nativeOnly", "trrRace", "trrFirst", "trrOnly", "trrShadow"],
     "bug_numbers": [1434852],
     "description": "DNS: lookup algorithm"