diff --git a/app/app.py b/app/app.py index e9ca50b..cc7a442 100644 --- a/app/app.py +++ b/app/app.py @@ -3,8 +3,30 @@ # This program is licensed under the Apache License 2.0. # See LICENSE or go to for full license details. +import logging + import dash import dash_bootstrap_components as dbc +import sentry_sdk +from sentry_sdk.integrations.flask import FlaskIntegration + +import config as cfg + +# APP INSTANTIATION & OVERALL LAYOUT +logger = logging.getLogger("uvicorn.error") +# Sentry +if isinstance(cfg.SENTRY_DSN, str): + sentry_sdk.init( + dsn=cfg.SENTRY_DSN, + release=cfg.VERSION, + server_name=cfg.SERVER_NAME, + environment="production" if isinstance(cfg.SERVER_NAME, str) else None, + integrations=[ + FlaskIntegration(), + ], + traces_sample_rate=1.0, + ) + logger.info(f"Sentry middleware enabled on server {cfg.SERVER_NAME}") # We start by instantiating the app app = dash.Dash(__name__, external_stylesheets=[dbc.themes.UNITED])