]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: track telemetry report revisions
authorSage Weil <sage@redhat.com>
Thu, 25 Jul 2019 21:45:09 +0000 (16:45 -0500)
committerSage Weil <sage@redhat.com>
Wed, 6 Nov 2019 12:41:50 +0000 (06:41 -0600)
Assign revisions to track changes to the content of the telemetry
reports.

Track the revision when the user opts in or out.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit b93e4050261b962449c9721cea713616ce5e03bd)

src/pybind/mgr/telemetry/module.py

index 98aeb85462195e7792ca5a370fbcfee2f2bef032..2d60beb30002075bbd90ff6eaf3316973f4ee454 100644 (file)
@@ -23,6 +23,27 @@ LICENSE='sharing-1-0'
 LICENSE_NAME='Community Data License Agreement - Sharing - Version 1.0'
 LICENSE_URL='https://cdla.io/sharing-1-0/'
 
+# If the telemetry revision has changed since this point, re-require
+# an opt-in.  This should happen each time we add new information to
+# the telemetry report.
+LAST_REVISION_RE_OPT_IN = 2
+
+# Latest revision of the telemetry report.  Bump this each time we make
+# *any* change.
+REVISION = 2
+
+# History of revisions
+# --------------------
+#
+# Version 1:
+#   Mimic and/or nautilus are lumped together here, since
+#   we didn't track revisions yet.
+#
+# Version 2:
+#   - added revision tracking, nagging, etc.
+#   - added config option changes
+#   - added channels
+#   - added explicit license acknowledgement to the opt-in process
 
 class Module(MgrModule):
     config = dict()
@@ -49,6 +70,11 @@ class Module(MgrModule):
             'type': 'bool',
             'default': False
         },
+        {
+            'name': 'last_opt_revision',
+            'type': 'int',
+            'default': 1,
+        },
         {
             'name': 'leaderboard',
             'type': 'bool',
@@ -369,9 +395,11 @@ class Module(MgrModule):
             if command.get('license') != LICENSE:
                 return -errno.EPERM, '', "Telemetry data is licensed under the " + LICENSE_NAME + " (" + LICENSE_URL + ").\nTo enable, add '--license " + LICENSE + "' to the 'ceph telemetry on' command."
             self.set_module_option('enabled', True)
+            self.set_module_option('last_opt_revision', REVISION)
             return 0, '', ''
         elif command['prefix'] == 'telemetry off':
             self.set_module_option('enabled', False)
+            self.set_module_option('last_opt_revision', REVISION)
             return 0, '', ''
         elif command['prefix'] == 'telemetry send':
             self.last_report = self.compile_report()