Bug 1487559 - add new telemetry probe for the mime type causing suspension for back pressure r=francois,valentin
authorJunior Hsu <juhsu@mozilla.com>
Wed, 24 Oct 2018 16:26:19 +0000
changeset 442857 f7fe04d00e18682a760b3fcb458c2be801e59184
parent 442856 cca2b3ca9862d8ec5df6427f19438cb1e97e5b95
child 442858 f2ce0b583163feb057514003da2d60cc2fee8e28
push id71680
push userncsoregi@mozilla.com
push dateWed, 24 Oct 2018 21:24:50 +0000
treeherderautoland@f7fe04d00e18 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois, valentin
bugs1487559
milestone65.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 1487559 - add new telemetry probe for the mime type causing suspension for back pressure r=francois,valentin Differential Revision: https://phabricator.services.mozilla.com/D4729
netwerk/protocol/http/HttpChannelParent.cpp
toolkit/components/telemetry/Histograms.json
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -1640,26 +1640,34 @@ HttpChannelParent::OnStopRequest(nsIRequ
 
     isLocal = isLocal || IsLoopBackAddress(&peerAddr);
 
     if (!isLocal) {
       if (!mHasSuspendedByBackPressure) {
         AccumulateCategorical(Telemetry::LABELS_NETWORK_BACK_PRESSURE_SUSPENSION_RATE_V2::NotSuspended);
       } else {
         AccumulateCategorical(Telemetry::LABELS_NETWORK_BACK_PRESSURE_SUSPENSION_RATE_V2::Suspended);
+
+        // Only analyze non-local suspended cases, which we are interested in.
+        nsCOMPtr<nsILoadInfo> loadInfo;
+        if (NS_SUCCEEDED(mChannel->GetLoadInfo(getter_AddRefs(loadInfo)))) {
+          nsContentPolicyType type = loadInfo ?
+                                     loadInfo->InternalContentPolicyType() :
+                                     nsIContentPolicy::TYPE_OTHER;
+          Telemetry::Accumulate(Telemetry::NETWORK_BACK_PRESSURE_SUSPENSION_CP_TYPE, type);
+        }
       }
     } else {
       if (!mHasSuspendedByBackPressure) {
         AccumulateCategorical(Telemetry::LABELS_NETWORK_BACK_PRESSURE_SUSPENSION_RATE_V2::NotSuspendedLocal);
       } else {
         AccumulateCategorical(Telemetry::LABELS_NETWORK_BACK_PRESSURE_SUSPENSION_RATE_V2::SuspendedLocal);
       }
     }
   }
-
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // HttpChannelParent::nsIStreamListener
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -2002,16 +2002,25 @@
     "record_in_processes": ["main"],
     "expires_in_version": "68",
     "alert_emails": ["necko@mozilla.com", "junior@mozilla.com"],
     "bug_numbers": [1280629, 1494133],
     "kind": "categorical",
     "labels": ["Suspended", "NotSuspended", "SuspendedLocal", "NotSuspendedLocal"],
     "description": "Collect whether the resource is suspended by back pressure. And split by local-ness."
   },
+  "NETWORK_BACK_PRESSURE_SUSPENSION_CP_TYPE": {
+    "record_in_processes": ["main"],
+    "expires_in_version": "68",
+    "alert_emails": ["necko@mozilla.com", "junior@mozilla.com"],
+    "bug_numbers": [1487559],
+    "kind": "enumerated",
+    "n_values": 64,
+    "description": "Collect the content policy when the resource is non-local and suspended by back pressure (0-44 from nsContentPolicyType in nsIContentPolicy.idl)."
+  },
   "NETWORK_HTTP_REDIRECT_TO_SCHEME" :{
     "record_in_processes": ["main"],
     "alert_emails": ["necko@mozilla.com", "seceng-telemetry@mozilla.com", "jkt@mozilla.com"],
     "bug_numbers": [1413512],
     "expires_in_version": "64",
     "kind": "categorical",
     "keyed": true,
     "description": "Count of the HTTP redirection that triggered by top-level document or by subresource, keyed by the URL scheme redirected to.",