Bug 1580195 - Exclude calls of open(name, {}) and open(name) from telemetry. r=ttung,asuth
authorSimon Giesecke <sgiesecke@mozilla.com>
Fri, 13 Sep 2019 16:55:13 +0000
changeset 493111 f1d229db816d432127f0170693907cfb9e3c7a0b
parent 493110 845c6cac22129cefe7cce8a9ddda771e07ef1003
child 493112 165967b7940876cd8e4502cc4e5628dbd7c33d84
push id95331
push usercsabou@mozilla.com
push dateFri, 13 Sep 2019 17:10:53 +0000
treeherderautoland@f1d229db816d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttung, asuth
bugs1580195
milestone71.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 1580195 - Exclude calls of open(name, {}) and open(name) from telemetry. r=ttung,asuth Differential Revision: https://phabricator.services.mozilla.com/D45812
dom/indexedDB/IDBFactory.cpp
--- a/dom/indexedDB/IDBFactory.cpp
+++ b/dom/indexedDB/IDBFactory.cpp
@@ -480,19 +480,25 @@ already_AddRefed<IDBOpenDBRequest> IDBFa
     } else if (!NS_IsMainThread()) {
       // The method below reports on the main thread too, so we need to make
       // sure we're on a worker. Workers don't have a WarnOnceAbout mechanism,
       // so this will be reported every time.
       WorkerPrivate::ReportErrorToConsole("IDBOpenDBOptions_StorageType");
     }
   }
 
-  const auto principalType = IdentifyPrincipalType(*mPrincipalInfo);
-
-  Telemetry::AccumulateCategorical(principalType);
+  // Ignore calls with empty options for telemetry of usage count.
+  // Unfortunately, we cannot distinguish between the use of the method with
+  // only a single argument (which actually is a standard overload we don't want
+  // to count) an empty dictionary passed explicitly (which is the custom
+  // overload we would like to count). However, we assume that the latter is so
+  // rare that it can be neglected.
+  if (aOptions.IsAnyMemberPresent()) {
+    Telemetry::AccumulateCategorical(IdentifyPrincipalType(*mPrincipalInfo));
+  }
 
   return OpenInternal(aCx,
                       /* aPrincipal */ nullptr, aName, aOptions.mVersion,
                       aOptions.mStorage,
                       /* aDeleting */ false, aCallerType, aRv);
 }
 
 already_AddRefed<IDBOpenDBRequest> IDBFactory::DeleteDatabase(