示例#1
0
def LogBisectResult(bug_id, comment):
  """Adds an entry to the bisect result log for a particular bug."""
  if not bug_id or bug_id < 0:
    return
  formatter = quick_logger.Formatter()
  logger = quick_logger.QuickLogger('bisect_result', bug_id, formatter)
  logger.Log(comment)
  logger.Save()
def _AddReportToLog(report_dict):
    """Adds a log for bench results."""
    report = _REPORT_TEMPLATE % report_dict
    formatter = quick_logger.Formatter()
    logger = quick_logger.QuickLogger('bench_find_anomalies', 'report',
                                      formatter)
    logger.Log(report)
    logger.Save()
示例#3
0
def _LogBisectInfraFailure(bug_id, failure_message, stdio_url):
    """Adds infrastructure related bisect failures to log."""
    comment = failure_message + '\n'
    comment += ('<a href="https://chromeperf.appspot.com/group_report?'
                'bug_id=%s">%s</a>\n' % (bug_id, bug_id))
    comment += 'Buildbot stdio: <a href="%s">%s</a>\n' % (stdio_url, stdio_url)
    formatter = quick_logger.Formatter()
    logger = quick_logger.QuickLogger('bisect_failures', 'infra', formatter)
    logger.Log(comment)
    logger.Save()
def UpdateQuickLog(job):
    report = bisect_report.GetReport(job)
    if not report:
        logging.error('Bisect report returns empty for job id %s, bug_id %s.',
                      job.key.id(), job.bug_id)
        return
    formatter = quick_logger.Formatter()
    logger = quick_logger.QuickLogger('bisect_result', job.bug_id, formatter)
    logger.Log(report)
    logger.Save()
示例#5
0
 def testQuickLogger_SaveAndGetNewLogEntry(self):
     template = '{message}{extra}'
     formatter = quick_logger.Formatter(template, extra='!')
     logger = quick_logger.QuickLogger('a_namespace', 'a_log_name',
                                       formatter)
     logger.Log('Hello world')
     logger.Save()
     logs = quick_logger.Get('a_namespace', 'a_log_name')
     self.assertEqual(len(logs), 1)
     self.assertEqual(logs[0].message, 'Hello world!')
示例#6
0
 def testQuickLogger(self):
   """Tests basic logging."""
   template = '{message}{extra}'
   formatter = quick_logger.Formatter(template, extra='!')
   logger = quick_logger.QuickLogger('a_namespace', 'a_log_name', formatter)
   logger.Log('Hello %s', 'world')
   logger.Save()
   logs = quick_logger.Get('a_namespace', 'a_log_name')
   self.assertEqual(len(logs), 1)
   self.assertEqual(logs[0].message, 'Hello world!')
示例#7
0
def LogBisectResult(job, comment):
    """Adds an entry to the bisect result log for a particular bug."""
    if not job.bug_id or job.bug_id < 0:
        return
    formatter = quick_logger.Formatter()
    logger = quick_logger.QuickLogger('bisect_result', job.bug_id, formatter)
    if job.log_record_id:
        logger.Log(comment, record_id=job.log_record_id)
        logger.Save()
    else:
        job.log_record_id = logger.Log(comment)
        logger.Save()
        job.put()
示例#8
0
def _AddLogForRecoveredAnomaly(anomaly_entity):
    """Adds a quick log entry for an anomaly that has recovered."""
    formatter = quick_logger.Formatter()
    sheriff_key = anomaly_entity.test.get().sheriff
    if not sheriff_key:
        return
    sheriff_name = sheriff_key.string_id()
    logger = quick_logger.QuickLogger('auto_triage', sheriff_name, formatter)
    logger.Log('Alert on %s has recovered. See <a href="%s">graph</a>.%s',
               utils.TestPath(anomaly_entity.test),
               ('https://chromeperf.appspot.com/group_report?keys=' +
                anomaly_entity.key.urlsafe()), _BugLink(anomaly_entity))
    logger.Save()
示例#9
0
def _AddLogForBugAssociate(anomaly_entity, bug_id):
  """Adds a log for associating alert with a bug."""
  sheriff = anomaly_entity.test.get().sheriff
  if not sheriff:
    return
  # TODO(qyearsley): Add test coverage. See http://crbug.com/447432
  sheriff = sheriff.string_id()
  html_str = 'Associated alert on %s with bug <a href="%s">%s</a>.'
  bug_url = ('https://chromeperf.appspot.com/group_report?bug_id=' +
             str(bug_id))
  test_path = utils.TestPath(anomaly_entity.test)
  formatter = quick_logger.Formatter()
  logger = quick_logger.QuickLogger('auto_triage', sheriff, formatter)
  logger.Log(html_str, test_path, bug_url, bug_id)
  logger.Save()
示例#10
0
def _AddLogForBugAssociate(anomaly_entity):
  """Adds a log for associating alert with a bug."""
  bug_id = anomaly_entity.bug_id
  sheriff = anomaly_entity.GetTestMetadataKey().get().sheriff
  if not sheriff:
    return
  sheriff = sheriff.string_id()
  bug_url = ('https://chromeperf.appspot.com/group_report?bug_id=' +
             str(bug_id))
  test_path = utils.TestPath(anomaly_entity.GetTestMetadataKey())
  html_str = ('Associated alert on %s with bug <a href="%s">%s</a>.' %
              (test_path, bug_url, bug_id))
  formatter = quick_logger.Formatter()
  logger = quick_logger.QuickLogger('auto_triage', sheriff, formatter)
  logger.Log(html_str)
  logger.Save()
示例#11
0
def UpdateQuickLog(job):
    if not job.bug_id or job.bug_id < 0:
        return
    report = bisect_report.GetReport(job)
    if not report:
        logging.error('Bisect report returns empty for job id %s, bug_id %s.',
                      job.key.id(), job.bug_id)
        return
    formatter = quick_logger.Formatter()
    logger = quick_logger.QuickLogger('bisect_result', job.bug_id, formatter)
    if job.log_record_id:
        logger.Log(report, record_id=job.log_record_id)
        logger.Save()
    else:
        job.log_record_id = logger.Log(report)
        logger.Save()
        job.put()
示例#12
0
def _AddLogForRecoveredAnomaly(anomaly_entity, bug_id=None):
  """Adds a log for an anomaly that has recovered."""
  sheriff_key = anomaly_entity.test.get().sheriff
  if not sheriff_key:
    return
  sheriff_name = sheriff_key.string_id()
  html_str = 'Alert on %s has recovered.%s See <a href="%s">graph</a>.'
  alert_url = ('https://chromeperf.appspot.com/group_report?keys=' +
               anomaly_entity.key.urlsafe())
  bug_link = ''
  if bug_id:
    bug_link = (' Bug: <a href="https://chromeperf.appspot.com/group_report?'
                'bug_id=%s">%s</a>' % (bug_id, bug_id))

  test_path = utils.TestPath(anomaly_entity.test)
  formatter = quick_logger.Formatter()
  logger = quick_logger.QuickLogger('auto_triage', sheriff_name, formatter)
  logger.Log(html_str, test_path, bug_link, alert_url)
  logger.Save()
示例#13
0
def _LogFeedback(try_job_id, email):
    formatter = quick_logger.Formatter()
    logger = quick_logger.QuickLogger('bad_bisect', 'report', formatter)
    message = '%s marked try job %d.' % (email, try_job_id)
    logger.Log(message)
    logger.Save()
示例#14
0
def _AddReportToLog(report):
    """Adds a log for bench results."""
    formatter = quick_logger.Formatter()
    logger = quick_logger.QuickLogger('task_runner', 'report', formatter)
    logger.Log(report)
    logger.Save()