Skip to content

Commit

Permalink
glad-web: switch to a modern sentry sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Sep 29, 2024
1 parent 9dfaab9 commit cd2f2e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN pip install --no-cache-dir --use-pep517 \
eventlet>0.33.3 \
flask \
Flask-AutoIndex \
raven[flask] \
sentry-sdk[flask] \
lxml

COPY docker/* ./
Expand Down
9 changes: 4 additions & 5 deletions gladweb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
from werkzeug.middleware.proxy_fix import ProxyFix

try:
from raven.contrib.flask import Sentry
sentry = Sentry()
import sentry_sdk
except ImportError:
sentry = None
sentry_sdk = None


logger = logging.getLogger('gladweb')
Expand Down Expand Up @@ -125,8 +124,8 @@ def create_application(debug=False, verbose=False):
if verbose or (not app.debug and verbose is None):
setup_logging()

if sentry is not None and app.config.get('SENTRY_CONFIG'):
sentry.init_app(app, logging=True, level=logging.WARN)
if sentry_sdk is not None and app.config.get('SENTRY_CONFIG'):
sentry_sdk.init(**app.config.get('SENTRY_CONFIG', {}))

if app.config['CRON'] > 0:
cron = RefreshCron(app.config['CRON'], app)
Expand Down
4 changes: 2 additions & 2 deletions gladweb/views/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def generate():
url = glad_generate()
except Exception as e:
import gladweb
if gladweb.sentry is not None:
gladweb.sentry.captureException()
if gladweb.sentry_sdk is not None:
gladweb.sentry_sdk.capture_exception()

if isinstance(e, GladWebException):
current_app.logger.info('user error: %s', e)
Expand Down

0 comments on commit cd2f2e0

Please sign in to comment.