Skip to content

Commit

Permalink
Add sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
amandine-sahl committed Aug 29, 2023
1 parent bd15e2b commit e796317
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ def create_app():
app = Flask(__name__)

app.config.from_pyfile("./config/config.py")

# Sentry
if app.config.get("SENTRY_DSN"):
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration

Check warning on line 29 in backend/app.py

View check run for this annotation

Codecov / codecov/patch

backend/app.py#L28-L29

Added lines #L28 - L29 were not covered by tests

sentry_sdk.init(

Check warning on line 31 in backend/app.py

View check run for this annotation

Codecov / codecov/patch

backend/app.py#L31

Added line #L31 was not covered by tests
dsn=app.config["SENTRY_DSN"],
integrations=[FlaskIntegration()],
traces_sample_rate=1.0,
)

if app.config["DEBUG"] or app.config["TESTING"]:
email_validator.TEST_ENVIRONMENT = True

Expand Down
2 changes: 2 additions & 0 deletions backend/config/config.py.sample
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ COOKIE_EXPIRATION = 43200
COOKIE_AUTORENEW = True
TRAP_ALL_EXCEPTIONS = False

# --- Sentry ---
SENTRY_DSN = "https://<UUID>@sentry.mondomaine.org/<ID_PROJECT>"

# --- Flask Mail settings ---

Expand Down
1 change: 1 addition & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ psycopg2==2.9.6
# via -r requirements.in
pytz==2023.3
# via babel
sentry-sdk==1.29.2
six==1.16.0
# via flask-cors
sqlalchemy==2.0.15
Expand Down
5 changes: 5 additions & 0 deletions docs/deploiement.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,8 @@ Configuration générale de l'application
**Style (`public/css/custom.css`)**

Vous pouvez customiser l'application en ajoutant du css dans le fichier `public/css/custom.css`


## Monitoring - Sentry

Il est possible d'utiliser Sentry pour suivre l'application. Pour cela il suffit de renseigner la variable `SENTRY_DSN` du fichier de configuration.

0 comments on commit e796317

Please sign in to comment.