Bug 1364362 - Add doc link for Histograms.json record_in_processes errors. r=chutten

This commit is contained in:
Georg Fritzsche 2017-05-12 21:48:38 +07:00
Родитель 3446bf0d06
Коммит fd9d34a0d4
1 изменённых файлов: 12 добавлений и 7 удалений

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

@ -19,6 +19,11 @@ MAX_LABEL_LENGTH = 20
MAX_LABEL_COUNT = 100 MAX_LABEL_COUNT = 100
MIN_CATEGORICAL_BUCKET_COUNT = 50 MIN_CATEGORICAL_BUCKET_COUNT = 50
BASE_DOC_URL = ("https://gecko.readthedocs.io/en/latest/toolkit/components/"
"telemetry/telemetry/")
HISTOGRAMS_DOC_URL = (BASE_DOC_URL + "collection/histograms.html")
SCALARS_DOC_URL = (BASE_DOC_URL + "collection/scalars.html")
# histogram_tools.py is used by scripts from a mozilla-central build tree # histogram_tools.py is used by scripts from a mozilla-central build tree
# and also by outside consumers, such as the telemetry server. We need # and also by outside consumers, such as the telemetry server. We need
# to ensure that importing things works in both contexts. Therefore, # to ensure that importing things works in both contexts. Therefore,
@ -311,22 +316,22 @@ associated with the histogram. Returns None if no guarding is necessary."""
field = 'record_in_processes' field = 'record_in_processes'
rip = definition.get(field) rip = definition.get(field)
DOC_URL = HISTOGRAMS_DOC_URL + "#record-in-processes"
if not rip: if not rip:
raise ParserError('Histogram "%s" must have a "%s" field.' % (name, field)) raise ParserError('Histogram "%s" must have a "%s" field:\n%s'
% (name, field, DOC_URL))
for process in rip: for process in rip:
if not utils.is_valid_process_name(process): if not utils.is_valid_process_name(process):
raise ParserError('Histogram "%s" has unknown process "%s" in %s.' % raise ParserError('Histogram "%s" has unknown process "%s" in %s.\n%s' %
(name, process, field)) (name, process, field, DOC_URL))
def check_whitelisted_kind(self, name, definition): def check_whitelisted_kind(self, name, definition):
# We don't need to run any of these checks on the server. # We don't need to run any of these checks on the server.
if not self._strict_type_checks or whitelists is None: if not self._strict_type_checks or whitelists is None:
return return
DOC_URL = ("https://gecko.readthedocs.io/en/latest/toolkit/"
"components/telemetry/telemetry/collection/scalars.html")
# Disallow "flag" and "count" histograms on desktop, suggest to use # Disallow "flag" and "count" histograms on desktop, suggest to use
# scalars instead. Allow using these histograms on Android, as we # scalars instead. Allow using these histograms on Android, as we
# don't support scalars there yet. # don't support scalars there yet.
@ -343,7 +348,7 @@ associated with the histogram. Returns None if no guarding is necessary."""
'%s\n' '%s\n'
'Are you trying to add a histogram on Android?' 'Are you trying to add a histogram on Android?'
' Add "cpp_guard": "ANDROID" to your histogram definition.') ' Add "cpp_guard": "ANDROID" to your histogram definition.')
% (hist_kind, name, hist_kind, DOC_URL)) % (hist_kind, name, hist_kind, SCALARS_DOC_URL))
# Check for the presence of fields that old histograms are whitelisted for. # Check for the presence of fields that old histograms are whitelisted for.
def check_whitelistable_fields(self, name, definition): def check_whitelistable_fields(self, name, definition):