Bug 1277806 - Add support for the keyed scalars to the scalar registry. r=gfritzsche
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Wed, 07 Sep 2016 02:39:00 +0200
changeset 314717 66a2fa62d7601aaae4069bc9a2c4ec13854f65e7
parent 314716 c1e0b205c39b8946dfb485c0ecee7a5bc640815c
child 314718 d99209b752fbc75b35e437a476c14a93f54b0774
push id20583
push useralessio.placitelli@gmail.com
push dateWed, 21 Sep 2016 16:38:21 +0000
treeherderfx-team@73c0774056bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1277806
milestone52.0a1
Bug 1277806 - Add support for the keyed scalars to the scalar registry. r=gfritzsche MozReview-Commit-ID: 8dKj92Kh2Ev
toolkit/components/telemetry/ScalarInfo.h
toolkit/components/telemetry/gen-scalar-data.py
toolkit/components/telemetry/parse_scalars.py
--- a/toolkit/components/telemetry/ScalarInfo.h
+++ b/toolkit/components/telemetry/ScalarInfo.h
@@ -12,15 +12,16 @@
 // For the public interface to Telemetry functionality, see Telemetry.h.
 
 namespace {
 struct ScalarInfo {
   uint32_t kind;
   uint32_t name_offset;
   uint32_t expiration_offset;
   uint32_t dataset;
+  bool keyed;
 
   const char *name() const;
   const char *expiration() const;
 };
 } // namespace
 
 #endif // TelemetryScalarInfo_h__
--- a/toolkit/components/telemetry/gen-scalar-data.py
+++ b/toolkit/components/telemetry/gen-scalar-data.py
@@ -35,21 +35,22 @@ def write_scalar_info(scalar, output, na
     :param output: the output stream.
     :param name_index: the index of the scalar name in the strings table.
     :param expiration_index: the index of the expiration version in the strings table.
     """
     cpp_guard = scalar.cpp_guard
     if cpp_guard:
         print("#if defined(%s)" % cpp_guard, file=output)
 
-    print("  {{ {}, {}, {}, {} }},"\
+    print("  {{ {}, {}, {}, {}, {} }},"\
           .format(scalar.nsITelemetry_kind,
                   name_index,
                   expiration_index,
-                  scalar.dataset),
+                  scalar.dataset,
+                  "true" if scalar.keyed else "false"),
           file=output)
 
     if cpp_guard:
         print("#endif", file=output)
 
 def write_scalar_tables(scalars, output):
     """Writes the scalar and strings tables to an header file.
 
--- a/toolkit/components/telemetry/parse_scalars.py
+++ b/toolkit/components/telemetry/parse_scalars.py
@@ -81,17 +81,18 @@ class ScalarType:
             'description': basestring,
             'expires': basestring,
             'kind': basestring,
             'notification_emails': list # This contains strings. See LIST_FIELDS_CONTENT.
         }
 
         OPTIONAL_FIELDS = {
             'cpp_guard': basestring,
-            'release_channel_collection': basestring
+            'release_channel_collection': basestring,
+            'keyed': bool
         }
 
         # The types for the data within the fields that hold lists.
         LIST_FIELDS_CONTENT = {
             'bug_numbers': int,
             'notification_emails': basestring
         }
 
@@ -188,16 +189,21 @@ class ScalarType:
         return self._definition['expires']
 
     @property
     def kind(self):
         """Get the scalar kind"""
         return self._definition['kind']
 
     @property
+    def keyed(self):
+        """Boolean indicating whether this is a keyed scalar"""
+        return self._definition.get('keyed', False)
+
+    @property
     def nsITelemetry_kind(self):
         """Get the scalar kind constant defined in nsITelemetry"""
         return SCALAR_TYPES_MAP.get(self.kind)
 
     @property
     def notification_emails(self):
         """Get the list of notification emails"""
         return self._definition['notification_emails']