]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
run_tasks: use new sentry_sdk
authorJosh Durgin <jdurgin@redhat.com>
Mon, 4 Jan 2021 15:39:38 +0000 (10:39 -0500)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 6 Jan 2021 03:00:14 +0000 (22:00 -0500)
raven has been deprecated

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
requirements.in
requirements.txt
setup.py
teuthology/run_tasks.py
teuthology/sentry.py [deleted file]

index 2c8a330046406dee9175986a767a6a774afb92f0..625e55ed1aa60dd7518b8f4320ff3b6ff26a7b4d 100644 (file)
@@ -25,8 +25,8 @@ pyopenssl>=0.13
 python-dateutil
 python-novaclient
 python-openstackclient
-raven
 requests!=2.13.0
+sentry-sdk
 # test requires
 boto>=2.0b4
 boto3
index 3b6ca383ab0d4a6c4209147d38082103a127153a..001212a17cef1d75d80842af9127727e24efbd66 100644 (file)
@@ -25,7 +25,6 @@ cmd2==1.2.1               # via cliff
 colorama==0.4.3           # via cmd2
 configobj==5.0.6          # via -r requirements.in
 configparser==3.5.0       # via -r requirements.in
-contextlib2==0.6.0.post1  # via raven
 cryptography==3.2         # via -r requirements.in, ansible, openstacksdk, paramiko, pyopenssl
 debtcollector==2.1.0      # via oslo.config, oslo.utils, python-keystoneclient
 decorator==4.4.2          # via dogpile.cache, openstacksdk
@@ -86,11 +85,11 @@ python-novaclient==17.1.0  # via -r requirements.in, python-openstackclient
 python-openstackclient==5.3.1  # via -r requirements.in
 pytz==2020.1              # via oslo.serialization, oslo.utils
 pyyaml==5.1.2             # via -r requirements.in, ansible, cliff, openstacksdk, oslo.config
-raven==6.0.0              # via -r requirements.in
 requests==2.22.0          # via -r requirements.in, apache-libcloud, keystoneauth1, oslo.config, python-cinderclient, python-keystoneclient
 requestsexceptions==1.4.0  # via openstacksdk
 rfc3986==1.4.0            # via oslo.config
 s3transfer==0.2.1         # via boto3
+sentry-sdk==0.19.5        # via teuthology
 simplejson==3.17.0        # via osc-lib, python-cinderclient, python-novaclient
 six==1.14.0               # via -r requirements.in, bcrypt, cliff, configobj, cryptography, debtcollector, keystoneauth1, munch, oslo.i18n, oslo.utils, pip-tools, pynacl, pyopenssl, pytest, python-cinderclient, python-dateutil, python-keystoneclient, python-openstackclient, tox, virtualenv
 stevedore==3.1.0          # via cliff, keystoneauth1, osc-lib, oslo.config, python-keystoneclient, python-openstackclient
index cdbe81392ecb748828f868c25d82ad9d33175da0..119732e869d9e08d940907ff0eb448a4759fd680 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -87,8 +87,8 @@ setup(
             # with openstacklient >= 2.1.0, neutronclient no longer is
             # a dependency but we need it anyway.
             'python-neutronclient',
-            'raven',
             'requests != 2.13.0',
+            'sentry-sdk',
         ],
         'test': [
             'boto >= 2.0b4',       # for qa/tasks/radosgw_*.py
index 7067393fe85746fe3755cab1f00d728591d59a28..c8d36fdb8a6e195e283418f946832a07a15fb2af 100644 (file)
@@ -8,12 +8,12 @@ import yaml
 
 from copy import deepcopy
 from humanfriendly import format_timespan
+import sentry_sdk
 
 from teuthology.config import config as teuth_config
 from teuthology.exceptions import ConnectionLostError
 from teuthology.job_status import set_status, get_status
 from teuthology.misc import get_http_log_path, get_results_url
-from teuthology.sentry import get_client as get_sentry_client
 from teuthology.timer import Timer
 
 log = logging.getLogger(__name__)
@@ -104,8 +104,8 @@ def run_tasks(tasks, ctx):
             ctx.summary['failure_reason'] = str(e)
         log.exception('Saw exception from tasks.')
 
-        sentry = get_sentry_client()
-        if sentry:
+        if teuth_config.sentry_dsn:
+            sentry_sdk.init(teuth_config.sentry_dsn)
             config = deepcopy(ctx.config)
 
             tags = {
@@ -126,15 +126,16 @@ def run_tasks(tasks, ctx):
 
             job_id = ctx.config.get('job_id')
             archive_path = ctx.config.get('archive_path')
-            extra = dict(config=config,
+            extras = dict(config=config,
                          )
             if job_id:
-                extra['logs'] = get_http_log_path(archive_path, job_id)
+                extras['logs'] = get_http_log_path(archive_path, job_id)
 
-            exc_id = sentry.get_ident(sentry.captureException(
+            exc_id = sentry_sdk.capture_exception(
+                error=e,
                 tags=tags,
-                extra=extra,
-            ))
+                extras=extras,
+            )
             event_url = "{server}/?query={id}".format(
                 server=teuth_config.sentry_server.strip('/'), id=exc_id)
             log.exception(" Sentry event: %s" % event_url)
diff --git a/teuthology/sentry.py b/teuthology/sentry.py
deleted file mode 100644 (file)
index 655aea1..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-import logging
-from raven import Client
-from teuthology.config import config
-
-log = logging.getLogger(__name__)
-
-client = None
-
-
-def get_client():
-    global client
-    if client:
-        return client
-
-    dsn = config.sentry_dsn
-    if dsn:
-        client = Client(dsn=dsn)
-        return client