import sys
import logging
+from teuthology.sentry import get_client as get_sentry_client
log = logging.getLogger(__name__)
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...')
--- /dev/null
+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
+