Bug 1513473 - Re-enable the Text Encoding menu telemetry probes on the release channel. datareview=chutten. r=janerik, a=RyanVM
authorHenri Sivonen <hsivonen@hsivonen.fi>
Tue, 18 Dec 2018 09:06:55 +0000
changeset 509105 2f5faf2206df5e8fed5b12e4079c5dfe446b1987
parent 509104 c35977a3c5a3d1c6eb3ac66582143d7e9ef07665
child 509106 542014a5898ea48ef886246ba73797977c038fdc
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanerik, RyanVM
bugs1513473
milestone65.0
Bug 1513473 - Re-enable the Text Encoding menu telemetry probes on the release channel. datareview=chutten. r=janerik, a=RyanVM * Make the probes available on the release channel. * Migrate the probes to newer probe types. * Rename the probes. * Set email. * Set expiry. Differential Revision: https://phabricator.services.mozilla.com/D14237
docshell/base/nsDocShell.cpp
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/Scalars.yaml
toolkit/components/telemetry/histogram-whitelists.json
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -1233,68 +1233,76 @@ nsDocShell::GatherCharsetMenuTelemetry()
     return NS_OK;
   }
 
   nsIDocument* doc = viewer->GetDocument();
   if (!doc || doc->WillIgnoreCharsetOverride()) {
     return NS_OK;
   }
 
-  Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_USED, true);
+  Telemetry::ScalarSet(Telemetry::ScalarID::ENCODING_OVERRIDE_USED, true);
 
   bool isFileURL = false;
   nsIURI* url = doc->GetOriginalURI();
   if (url) {
     url->SchemeIs("file", &isFileURL);
   }
 
   int32_t charsetSource = doc->GetDocumentCharacterSetSource();
   switch (charsetSource) {
     case kCharsetFromTopLevelDomain:
       // Unlabeled doc on a domain that we map to a fallback encoding
-      Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 7);
+      Telemetry::AccumulateCategorical(
+          Telemetry::LABELS_ENCODING_OVERRIDE_SITUATION::RemoteTld);
       break;
     case kCharsetFromFallback:
     case kCharsetFromDocTypeDefault:
     case kCharsetFromCache:
     case kCharsetFromParentFrame:
     case kCharsetFromHintPrevDoc:
       // Changing charset on an unlabeled doc.
       if (isFileURL) {
-        Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 0);
+        Telemetry::AccumulateCategorical(
+            Telemetry::LABELS_ENCODING_OVERRIDE_SITUATION::Local);
       } else {
-        Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 1);
+        Telemetry::AccumulateCategorical(
+            Telemetry::LABELS_ENCODING_OVERRIDE_SITUATION::RemoteNonTld);
       }
       break;
     case kCharsetFromAutoDetection:
       // Changing charset on unlabeled doc where chardet fired
       if (isFileURL) {
-        Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 2);
+        Telemetry::AccumulateCategorical(
+            Telemetry::LABELS_ENCODING_OVERRIDE_SITUATION::LocalChardet);
       } else {
-        Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 3);
+        Telemetry::AccumulateCategorical(
+            Telemetry::LABELS_ENCODING_OVERRIDE_SITUATION::RemoteChardet);
       }
       break;
     case kCharsetFromMetaPrescan:
     case kCharsetFromMetaTag:
     case kCharsetFromChannel:
       // Changing charset on a doc that had a charset label.
-      Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 4);
+      Telemetry::AccumulateCategorical(
+          Telemetry::LABELS_ENCODING_OVERRIDE_SITUATION::Labeled);
       break;
     case kCharsetFromParentForced:
     case kCharsetFromUserForced:
       // Changing charset on a document that already had an override.
-      Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 5);
+      Telemetry::AccumulateCategorical(
+          Telemetry::LABELS_ENCODING_OVERRIDE_SITUATION::AlreadyOverridden);
       break;
     case kCharsetFromIrreversibleAutoDetection:
     case kCharsetFromOtherComponent:
     case kCharsetFromByteOrderMark:
     case kCharsetUninitialized:
     default:
       // Bug. This isn't supposed to happen.
-      Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 6);
+      Telemetry::AccumulateCategorical(
+          Telemetry::LABELS_ENCODING_OVERRIDE_SITUATION::Bug);
       break;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::SetCharset(const nsACString& aCharset) {
   // set the charset override
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -6846,28 +6846,25 @@
     "record_in_processes": ["content"],
     "alert_emails": ["mnakano@mozilla.com"],
     "bug_numbers": [1506434,1288640],
     "expires_in_version": "67",
     "kind": "boolean",
     "releaseChannelCollection": "opt-out",
     "description": "Deleted or to-be-reused innerwindow which has had text event listeners in the default group."
   },
-  "CHARSET_OVERRIDE_SITUATION": {
-    "record_in_processes": ["main", "content"],
-    "expires_in_version": "never",
-    "kind": "enumerated",
-    "n_values": 8,
-    "description": "Labeling status of top-level page when overriding charset (0: unlabeled file URL without detection, 1: unlabeled non-TLD-guessed non-file URL without detection, 2: unlabeled file URL with detection, 3: unlabeled non-file URL with detection, 4: labeled, 5: already overridden, 6: bug, 7: unlabeled with TLD guessing)"
-  },
-  "CHARSET_OVERRIDE_USED": {
-    "record_in_processes": ["main", "content"],
-    "expires_in_version": "never",
-    "kind": "flag",
-    "description": "Whether the character encoding menu was used to override an encoding in this session."
+  "ENCODING_OVERRIDE_SITUATION": {
+    "record_in_processes": ["main", "content"],
+    "alert_emails": ["hsivonen@mozilla.com"],
+    "bug_numbers": [840476, 977573, 1513473],
+    "expires_in_version": "69",
+    "releaseChannelCollection": "opt-out",
+    "kind": "categorical",
+    "labels": ["Local", "RemoteTld", "RemoteNonTld", "LocalChardet", "RemoteChardet", "Labeled", "AlreadyOverridden", "Bug"],
+    "description": "Labeling status of top-level page when overriding encoding"
   },
   "LONG_REFLOW_INTERRUPTIBLE": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "Long running reflow, interruptible or not"
   },
   "XMLHTTPREQUEST_ASYNC_OR_SYNC": {
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -2330,16 +2330,32 @@ browser.search:
     kind: uint
     notification_emails:
       - fx-search@mozilla.com
       - adw@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - main
 
+encoding:
+  override_used:
+    bug_numbers:
+      - 840476
+      - 1513473
+    description: >-
+      Whether the Text Encoding menu was used to override an encoding in this subsession.
+    expires: "69"
+    kind: boolean
+    notification_emails:
+      - hsivonen@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - main
+      - content
+
 # The following section is for probes testing the Telemetry system. They will not be
 # submitted in pings and are only used for testing.
 telemetry.test:
   unsigned_int_kind:
     bug_numbers:
       - 1276190
     description: >
       This is a test uint type with a really long description, maybe spanning even multiple
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -86,18 +86,16 @@
     "CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_NSPROCESSREQUESTEVENT_RUN",
     "CACHE_SERVICE_LOCK_WAIT_MAINTHREAD_NSSETDISKSMARTSIZECALLBACK_NOTIFY",
     "CANVAS_2D_USED",
     "CANVAS_WEBGL_USED",
     "CERT_CHAIN_KEY_SIZE_STATUS",
     "CERT_CHAIN_SHA1_POLICY_STATUS",
     "CHANGES_OF_DETECTED_LANGUAGE",
     "CHANGES_OF_TARGET_LANGUAGE",
-    "CHARSET_OVERRIDE_SITUATION",
-    "CHARSET_OVERRIDE_USED",
     "CHECK_ADDONS_MODIFIED_MS",
     "COMPONENTS_SHIM_ACCESSED_BY_CONTENT",
     "CONTENT_DOCUMENTS_DESTROYED",
     "CRASH_STORE_COMPRESSED_BYTES",
     "DATABASE_LOCKED_EXCEPTION",
     "DATABASE_SUCCESSFUL_UNLOCK",
     "DATA_STORAGE_ENTRIES",
     "DEFECTIVE_PERMISSIONS_SQL_REMOVED",
@@ -567,18 +565,16 @@
     "CERT_PINNING_RESULTS",
     "CERT_PINNING_TEST_RESULTS",
     "CERT_VALIDATION_HTTP_REQUEST_CANCELED_TIME",
     "CERT_VALIDATION_HTTP_REQUEST_FAILED_TIME",
     "CERT_VALIDATION_HTTP_REQUEST_RESULT",
     "CERT_VALIDATION_HTTP_REQUEST_SUCCEEDED_TIME",
     "CHANGES_OF_DETECTED_LANGUAGE",
     "CHANGES_OF_TARGET_LANGUAGE",
-    "CHARSET_OVERRIDE_SITUATION",
-    "CHARSET_OVERRIDE_USED",
     "CHECK_ADDONS_MODIFIED_MS",
     "COMPONENTS_SHIM_ACCESSED_BY_CONTENT",
     "COMPOSITE_FRAME_ROUNDTRIP_TIME",
     "COMPOSITE_TIME",
     "CONTENT_DOCUMENTS_DESTROYED",
     "COOKIE_SCHEME_SECURITY",
     "CRASH_STORE_COMPRESSED_BYTES",
     "CYCLE_COLLECTOR",
@@ -1391,17 +1387,16 @@
     "ADDON_MANAGER_UPGRADE_UI_SHOWN",
     "ALERTS_SERVICE_DND_SUPPORTED_FLAG",
     "AUDIO_MFT_OUTPUT_NULL_SAMPLES",
     "AUTO_REJECTED_TRANSLATION_OFFERS",
     "BROWSER_SHIM_USAGE_BLOCKED",
     "CANVAS_WEBGL_ACCL_FAILURE_ID",
     "CANVAS_WEBGL_FAILURE_ID",
     "CHANGES_OF_TARGET_LANGUAGE",
-    "CHARSET_OVERRIDE_USED",
     "COMPONENTS_SHIM_ACCESSED_BY_CONTENT",
     "CONTENT_DOCUMENTS_DESTROYED",
     "CSP_DOCUMENTS_COUNT",
     "CSP_UNSAFE_EVAL_DOCUMENTS_COUNT",
     "CSP_UNSAFE_INLINE_DOCUMENTS_COUNT",
     "CYCLE_COLLECTOR_OOM",
     "CYCLE_COLLECTOR_WORKER_OOM",
     "D3D11_COMPOSITING_FAILURE_ID",