]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Beginnings of support for Sentry.
authorZack Cerza <zack@cerza.org>
Wed, 21 Aug 2013 15:07:12 +0000 (10:07 -0500)
committerZack Cerza <zack@cerza.org>
Wed, 21 Aug 2013 15:07:12 +0000 (10:07 -0500)
requirements.txt
teuthology/run_tasks.py
teuthology/sentry.py [new file with mode: 0644]

index 8c5b8d0ec5543848ead4a6a74a513a17e69e2b24..4bcb1ab2cfe6a0fe737063286390dda407155b53 100644 (file)
@@ -12,6 +12,7 @@ httplib2
 paramiko >= 1.7.7
 pexpect
 requests == 0.14.0
+raven
 
 # Test Dependencies
 # nose >=1.0.0
index 8193839a6a3807ab3ef81a77b59921e3f2787930..1e61a4c607f69698ccfd19e820b2d8af950851c2 100644 (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...')
diff --git a/teuthology/sentry.py b/teuthology/sentry.py
new file mode 100644 (file)
index 0000000..ce17520
--- /dev/null
@@ -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
+