Bug 1412218 - Add telemetry probe for how many users with legacy cookie files. r=jdm, data-r=francois
authorJunior Hsu <juhsu@mozilla.com>
Sun, 05 Nov 2017 17:48:36 -0500
changeset 443516 8110a775c106a10810123208b86d9781b111647d
parent 443515 3d4a51bb3b210376c58239968e37d930d76f51fc
child 443517 8172eea4088e8ea74149b4151814ac4201e4fac1
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1412218
milestone58.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 1412218 - Add telemetry probe for how many users with legacy cookie files. r=jdm, data-r=francois
netwerk/cookie/nsCookieService.cpp
toolkit/components/telemetry/Histograms.json
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -1333,16 +1333,18 @@ nsCookieService::TryInitDB(bool aRecreat
           NS_LITERAL_CSTRING("ALTER TABLE moz_cookies ADD sameSite INTEGER"));
         COOKIE_LOGSTRING(LogLevel::Debug,
           ("Upgraded database to schema version 9"));
       }
 
       // No more upgrades. Update the schema version.
       rv = mDefaultDBState->syncConn->SetSchemaVersion(COOKIES_SCHEMA_VERSION);
       NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
+
+      Telemetry::Accumulate(Telemetry::MOZ_SQLITE_COOKIES_OLD_SCHEMA, dbSchemaVersion);
       MOZ_FALLTHROUGH;
 
     case COOKIES_SCHEMA_VERSION:
       break;
 
     case 0:
       {
         NS_WARNING("couldn't get schema version!");
@@ -1424,16 +1426,17 @@ nsCookieService::TryInitDB(bool aRecreat
       // Note that we have to switch out our DBState temporarily, in case we're in
       // private browsing mode; otherwise ImportCookies() won't be happy.
       DBState* initialState = gCookieService->mDBState;
       gCookieService->mDBState = gCookieService->mDefaultDBState;
       oldCookieFile->AppendNative(NS_LITERAL_CSTRING(OLD_COOKIE_FILE_NAME));
       gCookieService->ImportCookies(oldCookieFile);
       oldCookieFile->Remove(false);
       gCookieService->mDBState = initialState;
+      Telemetry::Accumulate(Telemetry::MOZ_SQLITE_COOKIES_OLD_SCHEMA, 0);
     });
 
   NS_DispatchToMainThread(runnable);
 
   return RESULT_OK;
 }
 
 void
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -4421,16 +4421,25 @@
   "MOZ_SQLITE_COOKIES_READ_MS": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "40",
     "kind": "exponential",
     "high": 3000,
     "n_buckets": 10,
     "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
   },
+  "MOZ_SQLITE_COOKIES_OLD_SCHEMA": {
+    "record_in_processes": ["main"],
+    "expires_in_version": "62",
+    "kind": "enumerated",
+    "n_values": 10,
+    "bug_numbers": [1412218],
+    "alert_emails": ["necko@mozilla.com", "junior@mozilla.com"],
+    "description": "Old schema version of the cookie database. 0 for having legacy cookies.txt."
+  },
   "MOZ_SQLITE_COOKIES_BLOCK_MAIN_THREAD_MS": {
     "record_in_processes": ["main"],
     "expires_in_version": "never",
     "kind": "exponential",
     "alert_emails": ["necko@mozilla.com", "junior@mozilla.com"],
     "bug_numbers": [870460],
     "high": 3000,
     "n_buckets": 10,