See Bug https://bugzilla.mozilla.org/show_bug.cgi?id=1271961.
This commit is contained in:
Roberto Agostino Vitillo 2016-05-12 13:12:28 +00:00
Родитель 5d1c89c22b
Коммит 68a56bc589
2 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -99,6 +99,7 @@ definition is a dict-like object that must contain at least the keys:
The key 'cpp_guard' is optional; if present, it denotes a preprocessor
symbol that should guard C/C++ definitions associated with the histogram."""
self._strict_type_checks = strict_type_checks
self._is_use_counter = name.startswith("USE_COUNTER2_")
self.verify_attributes(name, definition)
self._name = name
self._description = definition['description']
@ -215,16 +216,19 @@ associated with the histogram. Returns None if no guarding is necessary."""
table_dispatch(definition['kind'], table,
lambda allowed_keys: Histogram.check_keys(name, definition, allowed_keys))
if 'alert_emails' not in definition:
if whitelists is not None and name not in whitelists['alert_emails']:
raise KeyError, 'New histogram "%s" must have an alert_emails field.' % name
elif not isinstance(definition['alert_emails'], list):
raise KeyError, 'alert_emails must be an array (in histogram "%s")' % name
# Check for the alert_emails field. Use counters don't have any mechanism
# to add them, so skip the check for them.
if not self._is_use_counter:
if 'alert_emails' not in definition:
if whitelists is not None and name not in whitelists['alert_emails']:
raise KeyError, 'New histogram "%s" must have an alert_emails field.' % name
elif not isinstance(definition['alert_emails'], list):
raise KeyError, 'alert_emails must be an array (in histogram "%s")' % name
Histogram.check_name(name)
self.check_field_types(name, definition)
Histogram.check_expiration(name, definition)
Histogram.check_bug_numbers(name, definition)
self.check_bug_numbers(name, definition)
@staticmethod
def check_name(name):
@ -245,8 +249,10 @@ associated with the histogram. Returns None if no guarding is necessary."""
definition['expires_in_version'] = expiration
@staticmethod
def check_bug_numbers(name, definition):
def check_bug_numbers(self, name, definition):
# Use counters don't have any mechanism to add the bug numbers field.
if self._is_use_counter:
return
bug_numbers = definition.get('bug_numbers')
if not bug_numbers:
if whitelists is None or name in whitelists['bug_numbers']:
@ -287,6 +293,9 @@ associated with the histogram. Returns None if no guarding is necessary."""
return v
for key in [k for k in coerce_fields if k in definition]:
definition[key] = try_to_coerce_to_number(definition[key])
# This handles old "keyed":"true" definitions (bug 1271986).
if definition.get("keyed", None) == "true":
definition["keyed"] = True
for key, key_type in type_checked_fields.iteritems():
if not key in definition:

Просмотреть файл

@ -9,7 +9,7 @@ from setuptools import setup
setup(
name='python_moztelemetry',
version='0.3.9.9',
version='0.3.9.11',
author='Roberto Agostino Vitillo',
author_email='rvitillo@mozilla.com',
description='Spark bindings for Mozilla Telemetry',