Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion app/api/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': ''},
Expand Down
17 changes: 8 additions & 9 deletions app/views/healthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
"""
Expand All @@ -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'

Expand All @@ -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'


Expand All @@ -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'

Expand Down
3 changes: 0 additions & 3 deletions app/views/sentry.py

This file was deleted.

2 changes: 1 addition & 1 deletion requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down