diff --git a/app/__init__.py b/app/__init__.py index 442743aa22..4796713cc6 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -36,12 +36,13 @@ from app.models.event import Event from app.models.role_invite import RoleInvite from app.views.healthcheck import health_check_celery, health_check_db, health_check_migrations, check_migrations -from app.views.sentry import sentry from app.views.elastic_search import client from app.views.elastic_cron_helpers import sync_events_elasticsearch, cron_rebuild_events_elasticsearch from app.views.redis_store import redis_store from app.views.celery_ import celery from app.templates.flask_ext.jinja.filters import init_filters +import sentry_sdk +from sentry_sdk.integrations.flask import FlaskIntegration BASE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -157,7 +158,7 @@ def create_app(): # sentry if not app_created and 'SENTRY_DSN' in app.config: - sentry.init_app(app, dsn=app.config['SENTRY_DSN']) + sentry_sdk.init(app.config['SENTRY_DSN'], integrations=[FlaskIntegration()]) # redis redis_store.init_app(app) diff --git a/app/api/events.py b/app/api/events.py index 02f2cf06ab..a3e512f75a 100644 --- a/app/api/events.py +++ b/app/api/events.py @@ -50,7 +50,6 @@ from app.models.users_events_role import UsersEventsRoles from app.models.stripe_authorization import StripeAuthorization - def validate_event(user, modules, data): if not user.can_create_event(): raise ForbiddenException({'source': ''}, diff --git a/app/views/healthcheck.py b/app/views/healthcheck.py index dc6b524ff5..08c4b9dc44 100644 --- a/app/views/healthcheck.py +++ b/app/views/healthcheck.py @@ -5,8 +5,7 @@ from redis.exceptions import ConnectionError from app.models import db -from app.views.sentry import sentry - +from sentry_sdk import capture_exception, capture_message def health_check_celery(): """ @@ -16,22 +15,22 @@ def health_check_celery(): try: d = inspect().stats() if not d: - sentry.captureMessage('No running Celery workers were found.') + capture_message('No running Celery workers were found.') return False, 'No running Celery workers were found.' except ConnectionError as e: - sentry.captureException() + capture_exception(e) return False, 'cannot connect to redis server' except IOError as e: msg = "Error connecting to the backend: " + str(e) if len(e.args) > 0 and errorcode.get(e.args[0]) == 'ECONNREFUSED': msg += ' Check that the Redis server is running.' - sentry.captureException() + capture_exception(e) return False, msg except ImportError as e: - sentry.catureException() + capture_exception(e) return False, str(e) except Exception: - sentry.captureException() + capture_exception() return False, 'celery not ok' return True, 'celery ok' @@ -45,7 +44,7 @@ def health_check_db(): db.session.execute('SELECT 1') return True, 'database ok' except: - sentry.captureException() + capture_exception() return False, 'Error connecting to database' @@ -71,7 +70,7 @@ def check_migrations(): try: db.session.query(model).first() except: - sentry.captureException() + capture_exception() return 'failure,{} model out of date with migrations'.format(model) return 'success,database up to date with migrations' diff --git a/app/views/sentry.py b/app/views/sentry.py deleted file mode 100644 index 20ddeef3cd..0000000000 --- a/app/views/sentry.py +++ /dev/null @@ -1,3 +0,0 @@ -from raven.contrib.flask import Sentry - -sentry = Sentry() diff --git a/requirements/common.txt b/requirements/common.txt index 5c4dab50a3..f92f0ee448 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -48,7 +48,7 @@ wtforms~=2.2 flask-admin~=1.5 google-compute-engine~=2.8 factory_boy~=2.12 -raven[flask]~=6.10 +sentry-sdk[flask]~=0.8 healthcheck~=1.3 elasticsearch-dsl~=7.0 flask-redis~=0.3