Bug 1550756 - make system principal fall into new traffic category; r=dragana
authorLiang-Heng Chen <xeonchen@gmail.com>
Thu, 16 May 2019 13:24:18 +0000
changeset 532906 bcab46b227b6a31bc2df5cb83b482db2fc8df23a
parent 532905 14d8005e2dd100d19c7ce8cdf0e10cc4ca3fc2a7
child 532907 8c1f903def0c4fae9cf3efb9735df8310404fea9
push id11276
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:11:24 +0000
treeherdermozilla-beta@847755a7c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1550756
milestone68.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 1550756 - make system principal fall into new traffic category; r=dragana - add 2 category: system principals for normal/private browsing - P3Basic* and P3Content* are labeled incorrectly - add many assertions to check categories Differential Revision: https://phabricator.services.mozilla.com/D30660
netwerk/protocol/http/HttpTrafficAnalyzer.cpp
netwerk/protocol/http/HttpTrafficAnalyzer.h
netwerk/protocol/http/HttpTrafficAnalyzer.inc
netwerk/protocol/http/nsHttpChannel.cpp
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/Scalars.yaml
--- a/netwerk/protocol/http/HttpTrafficAnalyzer.cpp
+++ b/netwerk/protocol/http/HttpTrafficAnalyzer.cpp
@@ -15,18 +15,18 @@ namespace net {
 
 #define DEFINE_CATEGORY(_name, _idx) NS_LITERAL_CSTRING("Y" #_idx "_" #_name),
 static const nsCString gKeyName[] = {
 #include "HttpTrafficAnalyzer.inc"
 };
 #undef DEFINE_CATEGORY
 
 #define DEFINE_CATEGORY(_name, _idx) \
-  Telemetry::LABELS_HTTP_TRAFFIC_ANALYSIS_2::Y##_idx##_##_name,
-static const Telemetry::LABELS_HTTP_TRAFFIC_ANALYSIS_2 gTelemetryLabel[] = {
+  Telemetry::LABELS_HTTP_TRAFFIC_ANALYSIS_3::Y##_idx##_##_name,
+static const Telemetry::LABELS_HTTP_TRAFFIC_ANALYSIS_3 gTelemetryLabel[] = {
 #include "HttpTrafficAnalyzer.inc"
 };
 #undef DEFINE_CATEGORY
 
 // ----------------------------------------------------
 // | Flags                           |   Load Type    |
 // ----------------------------------------------------
 // | nsIClassOfService::Leader       |       A        |
@@ -37,69 +37,141 @@ static const Telemetry::LABELS_HTTP_TRAF
 // ----------------------------------------------------
 // | Basic Disconnected List         |       I        |
 // | Content                         |      II        |
 // | Fingerprinting                  |     III        |
 // ----------------------------------------------------
 // ====================================================
 // | Normal Mode                                      |
 // ----------------------------------------------------
-// | Y = 0 for first party                            |
-// | Y = 1 for non-listed third party type            |
+// | Y = 0 for system principals                      |
+// | Y = 1 for first party                            |
+// | Y = 2 for non-listed third party type            |
 // ----------------------------------------------------
 // |          \Y\          | Type A | Type B | Type C |
 // ----------------------------------------------------
-// | Category I            |    2   |    3   |    4   |
-// | Category II           |    5   |    6   |    7   |
-// | Category III          |    8   |    9   |   10   |
+// | Category I            |    3   |    4   |    5   |
+// | Category II           |    6   |    7   |    8   |
+// | Category III          |    9   |   10   |   11   |
 // ====================================================
 // | Private Mode                                     |
 // ----------------------------------------------------
-// | Y = 11 for first party                           |
-// | Y = 12 for non-listed third party type           |
+// | Y = 12 for system principals                     |
+// | Y = 13 for first party                           |
+// | Y = 14 for non-listed third party type           |
 // ----------------------------------------------------
 // |          \Y\          | Type A | Type B | Type C |
 // ----------------------------------------------------
-// | Category I            |   13   |   14   |   15   |
-// | Category II           |   16   |   17   |   18   |
-// | Category III          |   19   |   20   |   21   |
+// | Category I            |   15   |   16   |   17   |
+// | Category II           |   18   |   19   |   20   |
+// | Category III          |   21   |   22   |   23   |
 // ====================================================
 
 HttpTrafficCategory HttpTrafficAnalyzer::CreateTrafficCategory(
-    bool aIsPrivateMode, bool aIsThirdParty, ClassOfService aClassOfService,
-    TrackingClassification aClassification) {
-  uint8_t category = aIsPrivateMode ? 11 : 0;
+    bool aIsPrivateMode, bool aIsSystemPrincipal, bool aIsThirdParty,
+    ClassOfService aClassOfService, TrackingClassification aClassification) {
+  uint8_t category = aIsPrivateMode ? 12 : 0;
+  if (aIsSystemPrincipal) {
+    MOZ_ASSERT_IF(!aIsPrivateMode,
+                  gKeyName[category].EqualsLiteral("Y0_N1Sys"));
+    MOZ_ASSERT_IF(aIsPrivateMode,
+                  gKeyName[category].EqualsLiteral("Y12_P1Sys"));
+    return static_cast<HttpTrafficCategory>(category);
+  }
+  ++category;
+
   if (!aIsThirdParty) {
+    MOZ_ASSERT_IF(!aIsPrivateMode, gKeyName[category].EqualsLiteral("Y1_N1"));
+    MOZ_ASSERT_IF(aIsPrivateMode, gKeyName[category].EqualsLiteral("Y13_P1"));
     return static_cast<HttpTrafficCategory>(category);
   }
 
   switch (aClassification) {
     case TrackingClassification::eNone:
-      return static_cast<HttpTrafficCategory>(category + 1);
+      ++category;
+      MOZ_ASSERT_IF(!aIsPrivateMode,
+                    gKeyName[category].EqualsLiteral("Y2_N3Oth"));
+      MOZ_ASSERT_IF(aIsPrivateMode,
+                    gKeyName[category].EqualsLiteral("Y14_P3Oth"));
+      return static_cast<HttpTrafficCategory>(category);
     case TrackingClassification::eBasic:
       category += 2;
       break;
     case TrackingClassification::eContent:
       category += 5;
       break;
     case TrackingClassification::eFingerprinting:
       category += 8;
       break;
     default:
       MOZ_ASSERT(false, "incorrect classification");
       return HttpTrafficCategory::eInvalid;
   }
 
   switch (aClassOfService) {
     case ClassOfService::eLeader:
+      MOZ_ASSERT_IF(
+          !aIsPrivateMode,
+          (aClassification == TrackingClassification::eBasic &&
+           gKeyName[category].EqualsLiteral("Y3_N3BasicLead")) ||
+              (aClassification == TrackingClassification::eContent &&
+               gKeyName[category].EqualsLiteral("Y6_N3ContentLead")) ||
+              (aClassification == TrackingClassification::eFingerprinting &&
+               gKeyName[category].EqualsLiteral("Y9_N3FpLead")));
+      MOZ_ASSERT_IF(
+          aIsPrivateMode,
+          (aClassification == TrackingClassification::eBasic &&
+           gKeyName[category].EqualsLiteral("Y15_P3BasicLead")) ||
+              (aClassification == TrackingClassification::eContent &&
+               gKeyName[category].EqualsLiteral("Y18_P3ContentLead")) ||
+              (aClassification == TrackingClassification::eFingerprinting &&
+               gKeyName[category].EqualsLiteral("Y21_P3FpLead")));
       return static_cast<HttpTrafficCategory>(category);
     case ClassOfService::eBackground:
-      return static_cast<HttpTrafficCategory>(category + 1);
+      ++category;
+
+      MOZ_ASSERT_IF(
+          !aIsPrivateMode,
+          (aClassification == TrackingClassification::eBasic &&
+           gKeyName[category].EqualsLiteral("Y4_N3BasicBg")) ||
+              (aClassification == TrackingClassification::eContent &&
+               gKeyName[category].EqualsLiteral("Y7_N3ContentBg")) ||
+              (aClassification == TrackingClassification::eFingerprinting &&
+               gKeyName[category].EqualsLiteral("Y10_N3FpBg")));
+      MOZ_ASSERT_IF(
+          aIsPrivateMode,
+          (aClassification == TrackingClassification::eBasic &&
+           gKeyName[category].EqualsLiteral("Y16_P3BasicBg")) ||
+              (aClassification == TrackingClassification::eContent &&
+               gKeyName[category].EqualsLiteral("Y19_P3ContentBg")) ||
+              (aClassification == TrackingClassification::eFingerprinting &&
+               gKeyName[category].EqualsLiteral("Y22_P3FpBg")));
+
+      return static_cast<HttpTrafficCategory>(category);
     case ClassOfService::eOther:
-      return static_cast<HttpTrafficCategory>(category + 2);
+      category += 2;
+
+      MOZ_ASSERT_IF(
+          !aIsPrivateMode,
+          (aClassification == TrackingClassification::eBasic &&
+           gKeyName[category].EqualsLiteral("Y5_N3BasicOth")) ||
+              (aClassification == TrackingClassification::eContent &&
+               gKeyName[category].EqualsLiteral("Y8_N3ContentOth")) ||
+              (aClassification == TrackingClassification::eFingerprinting &&
+               gKeyName[category].EqualsLiteral("Y11_N3FpOth")));
+      MOZ_ASSERT_IF(
+          aIsPrivateMode,
+          (aClassification == TrackingClassification::eBasic &&
+           gKeyName[category].EqualsLiteral("Y17_P3BasicOth")) ||
+              (aClassification == TrackingClassification::eContent &&
+               gKeyName[category].EqualsLiteral("Y20_P3ContentOth")) ||
+              (aClassification == TrackingClassification::eFingerprinting &&
+               gKeyName[category].EqualsLiteral("Y23_P3FpOth")));
+
+      return static_cast<HttpTrafficCategory>(category);
   }
 
   MOZ_ASSERT(false, "incorrect class of service");
   return HttpTrafficCategory::eInvalid;
 }
 
 nsresult HttpTrafficAnalyzer::IncrementHttpTransaction(
     HttpTrafficCategory aCategory) {
@@ -168,16 +240,16 @@ nsresult HttpTrafficAnalyzer::Accumulate
 
   LOG(("HttpTrafficAnalyzer::AccumulateHttpTransferredSize [%s] rb=%" PRIu64 " "
        "sb=%" PRIu64 " [this=%p]\n",
        gKeyName[aCategory].get(), aBytesRead, aBytesSent, this));
 
   // Telemetry supports uint32_t only, and we send KB here.
   auto total = CLAMP_U32((aBytesRead >> 10) + (aBytesSent >> 10));
   if (aBytesRead || aBytesSent) {
-    Telemetry::ScalarAdd(Telemetry::ScalarID::NETWORKING_DATA_TRANSFERRED_KB,
+    Telemetry::ScalarAdd(Telemetry::ScalarID::NETWORKING_DATA_TRANSFERRED_V3_KB,
                          NS_ConvertUTF8toUTF16(gKeyName[aCategory]), total);
   }
   return NS_OK;
 }
 
 }  // namespace net
 }  // namespace mozilla
--- a/netwerk/protocol/http/HttpTrafficAnalyzer.h
+++ b/netwerk/protocol/http/HttpTrafficAnalyzer.h
@@ -27,18 +27,18 @@ class HttpTrafficAnalyzer final {
   enum TrackingClassification : uint8_t {
     eNone = 0,
     eBasic = 1,
     eContent = 2,
     eFingerprinting = 3,
   };
 
   static HttpTrafficCategory CreateTrafficCategory(
-      bool aIsPrivateMode, bool aIsThirdParty, ClassOfService aClassOfService,
-      TrackingClassification aClassification);
+      bool aIsPrivateMode, bool aIsSystemPrincipal, bool aIsThirdParty,
+      ClassOfService aClassOfService, TrackingClassification aClassification);
 
   nsresult IncrementHttpTransaction(HttpTrafficCategory aCategory);
   nsresult IncrementHttpConnection(HttpTrafficCategory aCategory);
   nsresult IncrementHttpConnection(nsTArray<HttpTrafficCategory>&& aCategories);
   nsresult AccumulateHttpTransferredSize(HttpTrafficCategory aCategory,
                                          uint64_t aBytesRead,
                                          uint64_t aBytesSent);
 };
--- a/netwerk/protocol/http/HttpTrafficAnalyzer.inc
+++ b/netwerk/protocol/http/HttpTrafficAnalyzer.inc
@@ -5,96 +5,102 @@
 //         which ones they are is to examine whether the channel belongs to a
 //         load group and do not have a LOAD_BACKGROUND load flag.
 //         If that condition holds, then it is blocking the load event of some document.
 // Type C) I think a simple way to find channels that don’t block document loads
 //         (e.g. XHR and fetch) is to look for those which are in a load group
 //         and have a LOAD_BACKGROUND load flag.
 
 
-// Y=0 - all requests/connections/bytes that are first party.
-DEFINE_CATEGORY(N1, 0)
+// Y=0 - all system principal connections.
+DEFINE_CATEGORY(N1Sys, 0)
 
-// Y=1 - all requests/connections/bytes that are third party
+// Y=1 - all requests/connections/bytes that are first party.
+DEFINE_CATEGORY(N1, 1)
+
+// Y=2 - all requests/connections/bytes that are third party
 // but don’t fall into other categories
-DEFINE_CATEGORY(N3Oth, 1)
-
-// Y=2 - all requests/connections/bytes associated with third party loads that
-// match the Analytics/Social/Advertising (Basic) Category and have a load of type (A)
-DEFINE_CATEGORY(N3BasicLead, 2)
+DEFINE_CATEGORY(N3Oth, 2)
 
 // Y=3 - all requests/connections/bytes associated with third party loads that
-// match the Analytics/Social/Advertising (Basic) Category and have a load of type (B)
-DEFINE_CATEGORY(N3BasicBg, 3)
+// match the Analytics/Social/Advertising (Basic) Category and have a load of type (A)
+DEFINE_CATEGORY(N3BasicLead, 3)
 
 // Y=4 - all requests/connections/bytes associated with third party loads that
-// match the Analytics/Social/Advertising (Basic) Category and have a load of type (C)
-DEFINE_CATEGORY(N3BasicOth, 4)
+// match the Analytics/Social/Advertising (Basic) Category and have a load of type (B)
+DEFINE_CATEGORY(N3BasicBg, 4)
 
 // Y=5 - all requests/connections/bytes associated with third party loads that
-// match the Content Category and have a load of type (A)
-DEFINE_CATEGORY(N3ContentLead, 5)
+// match the Analytics/Social/Advertising (Basic) Category and have a load of type (C)
+DEFINE_CATEGORY(N3BasicOth, 5)
 
 // Y=6 - all requests/connections/bytes associated with third party loads that
-// match the Content Category and have a load of type (B)
-DEFINE_CATEGORY(N3ContentBg, 6)
+// match the Content Category and have a load of type (A)
+DEFINE_CATEGORY(N3ContentLead, 6)
 
 // Y=7 - all requests/connections/bytes associated with third party loads that
-// match the Content Category and have a load of type (C)
-DEFINE_CATEGORY(N3ContentOth, 7)
+// match the Content Category and have a load of type (B)
+DEFINE_CATEGORY(N3ContentBg, 7)
 
 // Y=8 - all requests/connections/bytes associated with third party loads that
-// match the Fingerprinting Category and have a load of type (A)
-DEFINE_CATEGORY(N3FpLead, 8)
+// match the Content Category and have a load of type (C)
+DEFINE_CATEGORY(N3ContentOth, 8)
 
 // Y=9 - all requests/connections/bytes associated with third party loads that
-// match the Fingerprinting Category and have a load of type (B)
-DEFINE_CATEGORY(N3FpBg, 9)
+// match the Fingerprinting Category and have a load of type (A)
+DEFINE_CATEGORY(N3FpLead, 9)
 
 // Y=10 - all requests/connections/bytes associated with third party loads that
-// match the Fingerprinting Category and have a load of type (C)
-DEFINE_CATEGORY(N3FpOth, 10)
+// match the Fingerprinting Category and have a load of type (B)
+DEFINE_CATEGORY(N3FpBg, 10)
 
-// Y=11 - private mode and all requests/connections/bytes that are first party.
-DEFINE_CATEGORY(P1, 11)
-
-// Y=12 - private mode and all requests/connections/bytes that are third party
-// but don’t fall into other categories
-DEFINE_CATEGORY(P3Oth, 12)
+// Y=11 - all requests/connections/bytes associated with third party loads that
+// match the Fingerprinting Category and have a load of type (C)
+DEFINE_CATEGORY(N3FpOth, 11)
 
-// Y=13 - private mode and all requests/connections/bytes associated with
-// third party loads that match the Analytics/Social/Advertising (Basic) Category
-// and have a load of type (A)
-DEFINE_CATEGORY(P3ContentLead, 13)
+// Y=12 - private mode system principal connections.
+DEFINE_CATEGORY(P1Sys, 12)
 
-// Y=14 - private mode and all requests/connections/bytes associated with
-// third party loads that match the Analytics/Social/Advertising (Basic) Category
-// and have a load of type (B)
-DEFINE_CATEGORY(P3ContentBg, 14)
+// Y=13 - private mode and all requests/connections/bytes that are first party.
+DEFINE_CATEGORY(P1, 13)
+
+// Y=14 - private mode and all requests/connections/bytes that are third party
+// but don’t fall into other categories
+DEFINE_CATEGORY(P3Oth, 14)
 
 // Y=15 - private mode and all requests/connections/bytes associated with
 // third party loads that match the Analytics/Social/Advertising (Basic) Category
-// and have a load of type (C)
-DEFINE_CATEGORY(P3ContentOth, 15)
+// and have a load of type (A)
+DEFINE_CATEGORY(P3BasicLead, 15)
 
 // Y=16 - private mode and all requests/connections/bytes associated with
-// third party loads that match the Content Category and have a load of type (A)
-DEFINE_CATEGORY(P3BasicLead, 16)
+// third party loads that match the Analytics/Social/Advertising (Basic) Category
+// and have a load of type (B)
+DEFINE_CATEGORY(P3BasicBg, 16)
 
 // Y=17 - private mode and all requests/connections/bytes associated with
-// third party loads that match the Content Category and have a load of type (B)
-DEFINE_CATEGORY(P3BasicBg, 17)
+// third party loads that match the Analytics/Social/Advertising (Basic) Category
+// and have a load of type (C)
+DEFINE_CATEGORY(P3BasicOth, 17)
 
 // Y=18 - private mode and all requests/connections/bytes associated with
-// third party loads that match the Content Category and have a load of type (C)
-DEFINE_CATEGORY(P3BasicOth, 18)
+// third party loads that match the Content Category and have a load of type (A)
+DEFINE_CATEGORY(P3ContentLead, 18)
 
 // Y=19 - private mode and all requests/connections/bytes associated with
-// third party loads that match the Fingerprinting Category and have a load of type (A)
-DEFINE_CATEGORY(P3FpLead, 19)
+// third party loads that match the Content Category and have a load of type (B)
+DEFINE_CATEGORY(P3ContentBg, 19)
 
 // Y=20 - private mode and all requests/connections/bytes associated with
-// third party loads that match the Fingerprinting Category and have a load of type (B)
-DEFINE_CATEGORY(P3FpBg, 20)
+// third party loads that match the Content Category and have a load of type (C)
+DEFINE_CATEGORY(P3ContentOth, 20)
 
 // Y=21 - private mode and all requests/connections/bytes associated with
+// third party loads that match the Fingerprinting Category and have a load of type (A)
+DEFINE_CATEGORY(P3FpLead, 21)
+
+// Y=22 - private mode and all requests/connections/bytes associated with
+// third party loads that match the Fingerprinting Category and have a load of type (B)
+DEFINE_CATEGORY(P3FpBg, 22)
+
+// Y=23 - private mode and all requests/connections/bytes associated with
 // third party loads that match the Fingerprinting Category and have a load of type (C)
-DEFINE_CATEGORY(P3FpOth, 21)
+DEFINE_CATEGORY(P3FpOth, 23)
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -1315,17 +1315,17 @@ HttpTrafficCategory nsHttpChannel::Creat
              !mThirdPartyClassificationFlags);
 
   if (!StaticPrefs::network_traffic_analyzer_enabled()) {
     return HttpTrafficCategory::eInvalid;
   }
 
   HttpTrafficAnalyzer::ClassOfService cos;
   {
-    if (mClassOfService & nsIClassOfService::Leader &&
+    if ((mClassOfService & nsIClassOfService::Leader) &&
         mLoadInfo->GetExternalContentPolicyType() ==
             nsIContentPolicy::TYPE_SCRIPT) {
       cos = HttpTrafficAnalyzer::ClassOfService::eLeader;
     } else if (mLoadFlags & nsIRequest::LOAD_BACKGROUND) {
       cos = HttpTrafficAnalyzer::ClassOfService::eBackground;
     } else {
       cos = HttpTrafficAnalyzer::ClassOfService::eOther;
     }
@@ -1347,18 +1347,20 @@ HttpTrafficCategory nsHttpChannel::Creat
       tc = TC::eFingerprinting;
     } else if (flags & CF::CLASSIFIED_ANY_BASIC_TRACKING) {
       tc = TC::eBasic;
     } else {
       tc = TC::eNone;
     }
   }
 
-  return HttpTrafficAnalyzer::CreateTrafficCategory(NS_UsePrivateBrowsing(this),
-                                                    isThirdParty, cos, tc);
+  bool isSystemPrincipal = mLoadInfo->LoadingPrincipal() &&
+                           mLoadInfo->LoadingPrincipal()->IsSystemPrincipal();
+  return HttpTrafficAnalyzer::CreateTrafficCategory(
+      NS_UsePrivateBrowsing(this), isSystemPrincipal, isThirdParty, cos, tc);
 }
 
 enum class Report { Error, Warning };
 
 // Helper Function to report messages to the console when the loaded
 // script had a wrong MIME type.
 void ReportMimeTypeMismatch(nsHttpChannel* aChannel, const char* aMessageName,
                             nsIURI* aURI, const nsACString& aContentType,
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -14778,47 +14778,49 @@
           "IDB_GetFileSize",
           "IDB_GetWalFileSize",
           "IDB_GetUsage",
           "IDB_RemoveDBFiles"
       ],
       "keyed": true,
       "description": "Getting the number of errors in QuotaManager initialization."
   },
-  "HTTP_TRAFFIC_ANALYSIS_2": {
+  "HTTP_TRAFFIC_ANALYSIS_3": {
     "record_in_processes": ["main"],
     "alert_emails": ["gachen@mozilla.com"],
-    "bug_numbers": [1533363, 1546796, 1546906],
+    "bug_numbers": [1533363, 1546796, 1546906, 1550756],
     "expires_in_version": "73",
     "kind": "categorical",
     "n_values": 50,
     "labels": [
-      "Y0_N1",
-      "Y1_N3Oth",
-      "Y2_N3BasicLead",
-      "Y3_N3BasicBg",
-      "Y4_N3BasicOth",
-      "Y5_N3ContentLead",
-      "Y6_N3ContentBg",
-      "Y7_N3ContentOth",
-      "Y8_N3FpLead",
-      "Y9_N3FpBg",
-      "Y10_N3FpOth",
-      "Y11_P1",
-      "Y12_P3Oth",
-      "Y13_P3ContentLead",
-      "Y14_P3ContentBg",
-      "Y15_P3ContentOth",
-      "Y16_P3BasicLead",
-      "Y17_P3BasicBg",
-      "Y18_P3BasicOth",
-      "Y19_P3FpLead",
-      "Y20_P3FpBg",
-      "Y21_P3FpOth"
+      "Y0_N1Sys",
+      "Y1_N1",
+      "Y2_N3Oth",
+      "Y3_N3BasicLead",
+      "Y4_N3BasicBg",
+      "Y5_N3BasicOth",
+      "Y6_N3ContentLead",
+      "Y7_N3ContentBg",
+      "Y8_N3ContentOth",
+      "Y9_N3FpLead",
+      "Y10_N3FpBg",
+      "Y11_N3FpOth",
+      "Y12_P1Sys",
+      "Y13_P1",
+      "Y14_P3Oth",
+      "Y15_P3BasicLead",
+      "Y16_P3BasicBg",
+      "Y17_P3BasicOth",
+      "Y18_P3ContentLead",
+      "Y19_P3ContentBg",
+      "Y20_P3ContentOth",
+      "Y21_P3FpLead",
+      "Y22_P3FpBg",
+      "Y23_P3FpOth"
     ],
     "keyed": true,
     "keys": [
       "Connection",
       "Transaction"
     ],
-    "description": "Numbers of HTTP transactions and connections by type. There are some categories separated by labels based on 4 parameters: 1. normal browsing or private browsing 2. first party or third party 3. class of service (Leader/Background/Others) 4. tracking classification (Basic/Content/FingerprintingContent)."
+    "description": "Numbers of HTTP transactions and connections by type. There are some categories separated by labels based on 5 parameters: 1. normal browsing or private browsing 2. system principal or not 3. first party or third party 4. class of service (Leader/Background/Others) 5. tracking classification (Basic/Content/FingerprintingContent)."
   }
 }
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -3637,53 +3637,57 @@ script.preloader:
     notification_emails:
       - dothayer@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - 'main'
       - 'content'
 
 networking:
-  data_transferred_kb:
+  data_transferred_v3_kb:
     bug_numbers:
       - 1533363
       - 1546903
       - 1546796
       - 1546906
+      - 1550756
     description: >
       How many KB of HTTP data transferred by type, there are some categories
-      separated by keys based on 4 parameters:
+      separated by keys based on 5 parameters:
         1. normal browsing or private browsing
-        2. first party or third party
-        3. class of service (Leader/Background/Others)
-        4. tracking classification (Basic/Content/FingerprintingContent)
+        2. system principal or not
+        3. first party or third party
+        4. class of service (Leader/Background/Others)
+        5. tracking classification (Basic/Content/FingerprintingContent)
 
       Available keys are:
-        "Y0_N1",
-        "Y1_N3Oth",
-        "Y2_N3BasicLead",
-        "Y3_N3BasicBg",
-        "Y4_N3BasicOth",
-        "Y5_N3ContentLead",
-        "Y6_N3ContentBg",
-        "Y7_N3ContentOth",
-        "Y8_N3FpLead",
-        "Y9_N3FpBg",
-        "Y10_N3FpOth",
-        "Y11_P1",
-        "Y12_P3Oth",
-        "Y13_P3ContentLead",
-        "Y14_P3ContentBg",
-        "Y15_P3ContentOth",
-        "Y16_P3BasicLead",
-        "Y17_P3BasicBg",
-        "Y18_P3BasicOth",
-        "Y19_P3FpLead",
-        "Y20_P3FpBg",
-        "Y21_P3FpOth"
+        "Y0_N1Sys",
+        "Y1_N1",
+        "Y2_N3Oth",
+        "Y3_N3BasicLead",
+        "Y4_N3BasicBg",
+        "Y5_N3BasicOth",
+        "Y6_N3ContentLead",
+        "Y7_N3ContentBg",
+        "Y8_N3ContentOth",
+        "Y9_N3FpLead",
+        "Y10_N3FpBg",
+        "Y11_N3FpOth",
+        "Y12_P1Sys",
+        "Y13_P1",
+        "Y14_P3Oth",
+        "Y15_P3BasicLead",
+        "Y16_P3BasicBg",
+        "Y17_P3BasicOth",
+        "Y18_P3ContentLead",
+        "Y19_P3ContentBg",
+        "Y20_P3ContentOth",
+        "Y21_P3FpLead",
+        "Y22_P3FpBg",
+        "Y23_P3FpOth"
     expires: "73"
     keyed: true
     kind: uint
     notification_emails:
       - gachen@mozilla.com
     record_in_processes:
       - 'main'