mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1188888 - Part 7 - Bonus - Explicitly restrict histogram names to current patterns. r=chutten
This commit is contained in:
parent
35da089986
commit
880d394cc2
@ -248,6 +248,14 @@ associated with the histogram. Returns None if no guarding is necessary."""
|
||||
if name.startswith("LABELS_"):
|
||||
raise ValueError, "Histogram name '%s' can not start with LABELS_" % (name)
|
||||
|
||||
# To make it easier to generate C++ identifiers from this etc., we restrict
|
||||
# the histogram names to a strict pattern.
|
||||
# We skip this on the server to avoid failures with old Histogram.json revisions.
|
||||
if self._strict_type_checks:
|
||||
pattern = '^[a-z][a-z0-9_]+[a-z0-9]$'
|
||||
if not re.match(pattern, name, re.IGNORECASE):
|
||||
raise ValueError, "Histogram name '%s' doesn't confirm to '%s'" % (name, pattern)
|
||||
|
||||
def check_expiration(self, name, definition):
|
||||
expiration = definition.get('expires_in_version')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user