Beginnings of support for Sentry.

This commit is contained in:
Zack Cerza 2013-08-21 10:07:12 -05:00
parent 549bac3ede
commit 0af6a8a6f2
3 changed files with 20 additions and 1 deletions

View File

@ -12,6 +12,7 @@ httplib2
paramiko >= 1.7.7
pexpect
requests == 0.14.0
raven
# Test Dependencies
# nose >=1.0.0

View File

@ -1,5 +1,6 @@
import sys
import logging
from teuthology.sentry import get_client as get_sentry_client
log = logging.getLogger(__name__)
@ -30,7 +31,12 @@ def run_tasks(tasks, ctx):
ctx.summary['success'] = False
if 'failure_reason' not in ctx.summary:
ctx.summary['failure_reason'] = str(e)
log.exception('Saw exception from tasks')
msg = 'Saw exception from tasks.'
sentry = get_sentry_client(ctx)
if sentry:
exc_id = sentry.captureException()
msg += " Sentry id %s" % exc_id
log.exception(msg)
if ctx.config.get('interactive-on-error'):
from .task import interactive
log.warning('Saw failure, going into interactive mode...')

12
teuthology/sentry.py Normal file
View File

@ -0,0 +1,12 @@
from raven import Client
client = None
def get_client(ctx):
if client:
return client
dsn = ctx.teuthology_config.get('sentry_dsn')
if dsn:
client = Client(dsn=dsn)
return client