Bug 1337022 - Fix the regex in the Telemetry event parser. r=Dexter

This patch fixes the regex defined by IDENTIFIER_PATTERN in
toolkit/components/telemetry/parse_events.py to be less strict and fixes the
relative documentation.
To be precise, before this fix, the regex did not allow the category "ui" (which is described
in the documentation at the webpage
https://gecko.readthedocs.io/en/latest/toolkit/components/telemetry/telemetry/collection/events.html)
to be matched so the documentation was wrong.
The reason for that was that the regex required at least one extra character or
number to be in the string, so for example "uig" would have matched.
With this fix the category "ui" is allowed and matched by the new regex and the documentaion
(https://gecko.readthedocs.io/en/latest/toolkit/components/telemetry/telemetry/collection/events.html#limits)
is updated to reflect the change.

MozReview-Commit-ID: ID2aKOM1v7

--HG--
extra : rebase_source : 6f5dfb743ab9411bad7ed5b835af3d5a85846368
This commit is contained in:
Federico Padua 2017-03-17 11:59:17 +01:00
Родитель 32477d70c1
Коммит 2cc6e99240
2 изменённых файлов: 2 добавлений и 2 удалений

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

@ -46,7 +46,7 @@ Where the individual fields are:
Limits
------
Each ``String`` marked as an identifier is restricted to the following regex pattern: ``^[:alpha:][:alnum:_.]+[:alnum:]$``.
Each ``String`` marked as an identifier is restricted to the following regex pattern: ``^[:alpha:][:alnum:_.]*[:alnum:]$``.
For the Firefox Telemetry implementation, several fields are subject to limits:

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

@ -15,7 +15,7 @@ MAX_OBJECT_NAME_LENGTH = 20
MAX_EXTRA_KEYS_COUNT = 10
MAX_EXTRA_KEY_NAME_LENGTH = 15
IDENTIFIER_PATTERN = r'^[a-zA-Z][a-zA-Z0-9_.]+[a-zA-Z0-9]$'
IDENTIFIER_PATTERN = r'^[a-zA-Z][a-zA-Z0-9_.]*[a-zA-Z0-9]$'
DATE_PATTERN = r'^[0-9]{4}-[0-9]{2}-[0-9]{2}$'