Bug 1640867 - Add new HTTP_CHANNEL_ONSTART_SUCCESS_TRR probe r=dragana,tdsmith,necko-reviewers, a=jcristau
authorValentin Gosu <valentin.gosu@gmail.com>
Sat, 30 May 2020 08:39:17 +0000
changeset 596953 dfa0b3855b9fad60a7fda4374db86c8bb5b623aa
parent 596952 f0f45c8a7bb214fbd3cb3d051224216f3de5417c
child 596954 c4c1941f5a8d1110f2a80aab1ddbd1954cca070a
push id13215
push userjcristau@mozilla.com
push dateThu, 04 Jun 2020 13:33:19 +0000
treeherdermozilla-beta@d6fc47eb7f3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana, tdsmith, necko-reviewers, jcristau
bugs1640867
milestone78.0
Bug 1640867 - Add new HTTP_CHANNEL_ONSTART_SUCCESS_TRR probe r=dragana,tdsmith,necko-reviewers, a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D77127
netwerk/dns/TRRService.h
netwerk/protocol/http/nsHttpChannel.cpp
toolkit/components/telemetry/Histograms.json
--- a/netwerk/dns/TRRService.h
+++ b/netwerk/dns/TRRService.h
@@ -30,17 +30,17 @@ class TRRService : public TRRServiceBase
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOBSERVER
   NS_DECL_NSITIMERCALLBACK
 
   TRRService();
   nsresult Init();
   nsresult Start();
-  bool Enabled(nsIRequest::TRRMode aMode);
+  bool Enabled(nsIRequest::TRRMode aMode = nsIRequest::TRR_FIRST_MODE);
   bool IsConfirmed() { return mConfirmationState == CONFIRM_OK; }
 
   bool AllowRFC1918() { return mRfc1918; }
   bool UseGET() { return mUseGET; }
   bool EarlyAAAA() { return mEarlyAAAA; }
   bool CheckIPv6Connectivity() { return mCheckIPv6Connectivity; }
   bool WaitForAllResponses() { return mWaitForAllResponses; }
   bool DisableIPv6() { return mDisableIPv6; }
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -124,16 +124,17 @@
 #include "mozilla/net/AsyncUrlChannelClassifier.h"
 #include "mozilla/net/CookieJarSettings.h"
 #include "mozilla/net/NeckoChannelParams.h"
 #include "mozilla/net/UrlClassifierFeatureFactory.h"
 #include "HttpTrafficAnalyzer.h"
 #include "mozilla/net/SocketProcessParent.h"
 #include "js/Conversions.h"
 #include "mozilla/dom/SecFetch.h"
+#include "mozilla/net/TRRService.h"
 
 #ifdef MOZ_TASK_TRACER
 #  include "GeckoTaskTracer.h"
 #endif
 
 #ifdef MOZ_GECKO_PROFILER
 #  include "ProfilerMarkerPayload.h"
 #endif
@@ -7460,16 +7461,21 @@ nsHttpChannel::OnStartRequest(nsIRequest
 
   LOG(("nsHttpChannel::OnStartRequest [this=%p request=%p status=%" PRIx32
        "]\n",
        this, request, static_cast<uint32_t>(static_cast<nsresult>(mStatus))));
 
   Telemetry::Accumulate(Telemetry::HTTP_CHANNEL_ONSTART_SUCCESS,
                         NS_SUCCEEDED(mStatus));
 
+  if (gTRRService && gTRRService->IsConfirmed()) {
+    Telemetry::Accumulate(Telemetry::HTTP_CHANNEL_ONSTART_SUCCESS_TRR,
+                          TRRService::AutoDetectedKey(), NS_SUCCEEDED(mStatus));
+  }
+
   if (mRaceCacheWithNetwork) {
     LOG(
         ("  racingNetAndCache - mFirstResponseSource:%d fromCache:%d "
          "fromNet:%d\n",
          static_cast<int32_t>(mFirstResponseSource), request == mCachePump,
          request == mTransactionPump));
     if (mFirstResponseSource == RESPONSE_PENDING) {
       // When the cache wins mFirstResponseSource is set to
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3117,16 +3117,27 @@
     "products": ["firefox", "fennec", "geckoview"],
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "Successfully started HTTP channels",
     "bug_numbers": [1473333,1587226],
     "releaseChannelCollection": "opt-out",
     "alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"]
   },
+  "HTTP_CHANNEL_ONSTART_SUCCESS_TRR" : {
+    "record_in_processes": ["main"],
+    "products": ["firefox", "fennec", "geckoview"],
+    "expires_in_version": "never",
+    "kind": "boolean",
+    "keyed": true,
+    "description": "Successfully started HTTP channels when TRR is enabled; Keyed by TRR auto-detected",
+    "bug_numbers": [1640867],
+    "releaseChannelCollection": "opt-out",
+    "alert_emails": ["necko@mozilla.com", "vgosu@mozilla.com"]
+  },
   "HTTP_CONNECTION_ENTRY_CACHE_HIT_1" : {
     "record_in_processes": ["main", "content"],
     "products": ["firefox", "fennec", "geckoview"],
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "Fraction of sockets that used a nsConnectionEntry with history - size 300."
   },
   "HTTP_CACHE_DISPOSITION_3": {