Merge pull request #205 from ZeusWPI/add-sentry

Add glitchtip
This commit is contained in:
Charlotte Van Petegem 2022-10-27 19:41:26 +02:00 committed by GitHub
commit 1dcd723bd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 19 deletions

View file

@ -3,11 +3,13 @@
"""Main Haldis script""" """Main Haldis script"""
import logging import logging
import sentry_sdk
import typing import typing
from datetime import datetime from datetime import datetime
from logging.handlers import TimedRotatingFileHandler from logging.handlers import TimedRotatingFileHandler
from admin import init_admin from admin import init_admin
from config import Configuration
from flask import Flask, render_template from flask import Flask, render_template
from flask_bootstrap import Bootstrap, StaticCDN from flask_bootstrap import Bootstrap, StaticCDN
from flask_debugtoolbar import DebugToolbarExtension from flask_debugtoolbar import DebugToolbarExtension
@ -19,6 +21,7 @@ from login import init_login
from markupsafe import Markup from markupsafe import Markup
from models import db from models import db
from models.anonymous_user import AnonymouseUser from models.anonymous_user import AnonymouseUser
from sentry_sdk.integrations.flask import FlaskIntegration
from utils import euro_string, price_range_string, ignore_none from utils import euro_string, price_range_string, ignore_none
from zeus import init_oauth from zeus import init_oauth
@ -171,5 +174,10 @@ def create_app():
# For usage when you directly call the script with python # For usage when you directly call the script with python
if __name__ == "__main__": if __name__ == "__main__":
sentry_sdk.init(
dsn=Configuration.SENTRY_DSN,
integrations=[FlaskIntegration()]
)
app, app_mgr = create_app() app, app_mgr = create_app()
app_mgr.run() app_mgr.run()

View file

@ -12,5 +12,6 @@ class Configuration:
SECRET_KEY = "<change>" SECRET_KEY = "<change>"
SLACK_WEBHOOK = None SLACK_WEBHOOK = None
LOGFILE = "haldis.log" LOGFILE = "haldis.log"
SENTRY_DSN = "<change>"
ZEUS_KEY = "tomtest" ZEUS_KEY = "tomtest"
ZEUS_SECRET = "blargh" ZEUS_SECRET = "blargh"

View file

@ -12,3 +12,4 @@ black
pymysql pymysql
pyyaml pyyaml
tatsu<5.6 # >=5.6 needs Python >=3.8 tatsu<5.6 # >=5.6 needs Python >=3.8
sentry-sdk[flask]

View file

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.9
# To update, run: # To update, run:
# #
# pip-compile # pip-compile
@ -11,11 +11,15 @@ appdirs==1.4.4
black==21.6b0 black==21.6b0
# via -r requirements.in # via -r requirements.in
blinker==1.4 blinker==1.4
# via flask-debugtoolbar # via
# flask-debugtoolbar
# sentry-sdk
cachelib==0.1.1 cachelib==0.1.1
# via flask-oauthlib # via flask-oauthlib
certifi==2021.5.30 certifi==2021.5.30
# via requests # via
# requests
# sentry-sdk
chardet==4.0.0 chardet==4.0.0
# via requests # via requests
click==7.1.2 click==7.1.2
@ -24,6 +28,19 @@ click==7.1.2
# flask # flask
dominate==2.6.0 dominate==2.6.0
# via flask-bootstrap # via flask-bootstrap
flask==1.1.4
# via
# -r requirements.in
# flask-admin
# flask-bootstrap
# flask-debugtoolbar
# flask-login
# flask-migrate
# flask-oauthlib
# flask-script
# flask-sqlalchemy
# flask-wtf
# sentry-sdk
flask-admin==1.5.8 flask-admin==1.5.8
# via -r requirements.in # via -r requirements.in
flask-bootstrap==3.3.7.1 flask-bootstrap==3.3.7.1
@ -44,18 +61,6 @@ flask-sqlalchemy==2.5.1
# flask-migrate # flask-migrate
flask-wtf==0.15.1 flask-wtf==0.15.1
# via -r requirements.in # via -r requirements.in
flask==1.1.4
# via
# -r requirements.in
# flask-admin
# flask-bootstrap
# flask-debugtoolbar
# flask-login
# flask-migrate
# flask-oauthlib
# flask-script
# flask-sqlalchemy
# flask-wtf
greenlet==1.1.0 greenlet==1.1.0
# via sqlalchemy # via sqlalchemy
idna==2.10 idna==2.10
@ -92,10 +97,12 @@ pyyaml==5.4.1
# via -r requirements.in # via -r requirements.in
regex==2021.4.4 regex==2021.4.4
# via black # via black
requests-oauthlib==1.1.0
# via flask-oauthlib
requests==2.25.1 requests==2.25.1
# via requests-oauthlib # via requests-oauthlib
requests-oauthlib==1.1.0
# via flask-oauthlib
sentry-sdk[flask]==1.10.1
# via -r requirements.in
six==1.16.0 six==1.16.0
# via python-dateutil # via python-dateutil
sqlalchemy==1.4.18 sqlalchemy==1.4.18
@ -106,8 +113,10 @@ tatsu==4.4.0
# via -r requirements.in # via -r requirements.in
toml==0.10.2 toml==0.10.2
# via black # via black
urllib3==1.26.5 urllib3==1.26.12
# via requests # via
# requests
# sentry-sdk
visitor==0.1.3 visitor==0.1.3
# via flask-bootstrap # via flask-bootstrap
werkzeug==1.0.1 werkzeug==1.0.1