bug 1237610 - use a mach setting to control telemetry submission. r=gps
authorTed Mielczarek <ted@mielczarek.org>
Tue, 07 Aug 2018 12:26:31 -0400
changeset 437687 9eed32a2c7f7965aa11e25da68d8eb714982b05b
parent 437686 328a9f04072daa04708d44ee729f54291e983691
child 437688 1b85b45460a36022d99cba049a92635fa8ffd1da
push id34690
push usercbrindusan@mozilla.com
push dateFri, 21 Sep 2018 17:30:01 +0000
treeherdermozilla-central@ce4e883f7642 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1237610
milestone64.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 1237610 - use a mach setting to control telemetry submission. r=gps Differential Revision: https://phabricator.services.mozilla.com/D4597
build/mach_bootstrap.py
python/mozbuild/mozbuild/mach_commands.py
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -185,17 +185,17 @@ def bootstrap(topsrcdir, mozilla_dir=Non
             # more robust.
             return mozversioncontrol.get_repository_object(path=mozilla_dir)
         except (mozversioncontrol.InvalidRepoPath,
                 mozversioncontrol.MissingVCSTool):
             return None
 
     def telemetry_handler(context, data):
         # We have not opted-in to telemetry
-        if 'BUILD_SYSTEM_TELEMETRY' not in os.environ:
+        if not context.settings.build.telemetry:
             return
 
         telemetry_dir = os.path.join(get_state_dir()[0], 'telemetry')
         try:
             os.mkdir(telemetry_dir)
         except OSError as e:
             if e.errno != errno.EEXIST:
                 raise
@@ -234,17 +234,17 @@ def bootstrap(topsrcdir, mozilla_dir=Non
 
         For now,  we will use this to handle build system telemetry.
         """
         # Don't do anything when...
         if should_skip_dispatch(context, handler):
             return
 
         # We have not opted-in to telemetry
-        if 'BUILD_SYSTEM_TELEMETRY' not in os.environ:
+        if not context.settings.build.telemetry:
             return
 
         # Every n-th operation
         if random.randint(1, TELEMETRY_SUBMISSION_FREQUENCY) != 1:
             return
 
         with open(os.devnull, 'wb') as devnull:
             subprocess.Popen([sys.executable,
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -2837,8 +2837,17 @@ class Analyze(MachCommandBase):
             # path to cost_dict.gz was specified
             if os.path.isfile(path):
                 r = Report(days, path)
                 r.generate_output(format, limit, self.topobjdir)
             else:
                 res = 'Please specify the location of cost_dict.gz with --path.'
                 print ('Could not find cost_dict.gz at %s' % path, res, sep='\n')
                 return 1
+
+
+@SettingsProvider
+class TelemetrySettings():
+    config_settings = [
+        ('build.telemetry', 'boolean', """
+Enable submission of build system telemetry.
+        """.strip(), False),
+    ]