Bug 1367750 - Allow new keys in Histograms.json if strict_type_checks is False r?Dexter draft
authorRaajit Raj <raajit.raj@gmail.com>
Fri, 26 May 2017 02:31:34 +0530
changeset 584606 057a635ff0bbf17c97384de52f5f1a871723001b
parent 583701 d93182f36b3c134a3b1c6718f09eb87c2913e364
child 630469 d308ebeb7a7641f4842f9206aa36aee5d9236390
push id60832
push userbmo:raajit.raj@gmail.com
push dateThu, 25 May 2017 21:02:04 +0000
reviewersDexter
bugs1367750
milestone55.0a1
Bug 1367750 - Allow new keys in Histograms.json if strict_type_checks is False r?Dexter MozReview-Commit-ID: LyB72VN0tDP
toolkit/components/telemetry/histogram_tools.py
--- a/toolkit/components/telemetry/histogram_tools.py
+++ b/toolkit/components/telemetry/histogram_tools.py
@@ -434,16 +434,18 @@ associated with the histogram.  Returns 
         for key, key_type in type_checked_list_fields.iteritems():
             if key not in definition:
                 continue
             if not all(isinstance(x, key_type) for x in definition[key]):
                 raise ParserError('All values for list "{0}" in histogram "{1}" should be of type'
                                   ' {2}.'.format(key, name, nice_type_name(key_type)))
 
     def check_keys(self, name, definition, allowed_keys):
+        if not self._strict_type_checks:
+            return
         for key in definition.iterkeys():
             if key not in allowed_keys:
                 raise ParserError('Key "%s" is not allowed for histogram "%s".' % (key, name))
 
     def set_bucket_parameters(self, low, high, n_buckets):
         self._low = low
         self._high = high
         self._n_buckets = n_buckets