Added sentry integrations

This commit is contained in:
Pünkösd Marcell 2020-11-27 18:16:37 +01:00
parent be3360b919
commit df29e05b6c
3 changed files with 19 additions and 1 deletions

View File

@ -2,6 +2,8 @@ import tempfile
import os
import os.path
import shutil
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from flask import Flask, current_app
from config import Config
@ -9,6 +11,18 @@ from config import Config
from utils import write_file_to_fd_while_calculating_md5, create_md5_sum_for_file
from converter import convert_caff_to_tga, convert_tga_to_png
# Setup sentry
if Config.SENTRY_DSN:
sentry_sdk.init(
dsn=Config.SENTRY_DSN,
integrations=[FlaskIntegration()],
traces_sample_rate=1.0,
send_default_pii=True,
release=Config.RELEASE_ID,
environment=Config.RELEASEMODE,
_experiments={"auto_enabling_integrations": True}
)
app = Flask(__name__)
app.config.from_object(Config)

View File

@ -7,3 +7,6 @@ class Config:
CONVERSION_TIMEOUT = int(os.environ.get('IMAGEMAGICK_CONVERT_BINARY', 30))
RECIEVE_CHUNKSIZE = int(os.environ.get('RECIEVE_CHUNKSIZE', 2048))
MAX_RECIEVE_SIZE = int(os.environ.get('MAX_RECIEVE_SIZE', 536870912)) # 512 MB
SENTRY_DSN = os.environ.get('SENTRY_DSN')
RELEASE_ID = os.environ.get('RELEASE_ID', 'test')
RELEASEMODE = os.environ.get('RELEASEMODE', 'dev')

View File

@ -1,2 +1,3 @@
Flask~=1.1.2
gunicorn~=20.0.4
sentry_sdk