mirror of
https://github.com/ceph/ceph
synced 2025-01-11 21:50:26 +00:00
Beginnings of support for Sentry.
This commit is contained in:
parent
549bac3ede
commit
0af6a8a6f2
@ -12,6 +12,7 @@ httplib2
|
||||
paramiko >= 1.7.7
|
||||
pexpect
|
||||
requests == 0.14.0
|
||||
raven
|
||||
|
||||
# Test Dependencies
|
||||
# nose >=1.0.0
|
||||
|
@ -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
12
teuthology/sentry.py
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user