def _AdditionalDetails(bug_id, alerts): """Returns a message with additional information to add to a bug.""" base_url = '%s/group_report' % _GetServerURL() bug_page_url = '%s?bug_id=%s' % (base_url, bug_id) sid = short_uri.GetOrCreatePageState(json.dumps(_UrlsafeKeys(alerts))) alerts_url = '%s?sid=%s' % (base_url, sid) comment = '<b>All graphs for this bug:</b>\n %s\n\n' % bug_page_url comment += ( '(For debugging:) Original alerts at time of bug-filing:\n %s\n' % alerts_url) bot_names = {a.bot_name for a in alerts} if bot_names: comment += '\n\nBot(s) for this bug\'s original alert(s):\n\n' comment += '\n'.join(sorted(bot_names)) else: comment += '\nCould not extract bot names from the list of alerts.' docs_by_suite = {} for a in alerts: test = a.GetTestMetadataKey() suite = test.id().split('/')[2] if suite in docs_by_suite: continue docs = _GetDocsForTest(test) if not docs: continue docs_by_suite[suite] = docs for k, v in docs_by_suite.items(): comment += '\n\n%s - %s:\n %s' % (k, v[0], v[1]) return comment
def _AdditionalDetails(bug_id, alerts): """Returns a message with additional information to add to a bug.""" base_url = '%s/group_report' % _GetServerURL() bug_page_url = '%s?bug_id=%s' % (base_url, bug_id) sid = short_uri.GetOrCreatePageState(json.dumps(_UrlsafeKeys(alerts))) alerts_url = '%s?sid=%s' % (base_url, sid) comment = '<b>All graphs for this bug:</b>\n %s\n\n' % bug_page_url comment += ('(For debugging:) Original alerts at time of bug-filing:\n %s\n' % alerts_url) bot_names = anomaly.GetBotNamesFromAlerts(alerts) if bot_names: comment += '\n\nBot(s) for this bug\'s original alert(s):\n\n' comment += '\n'.join(sorted(bot_names)) else: comment += '\nCould not extract bot names from the list of alerts.' return comment