Skip to content

Commit

Permalink
Add Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
DeD1rk committed May 14, 2024
1 parent 13858a1 commit 19b7e19
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions infra/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
image: ghcr.io/vincevd1/thaliany-server:${TAG:-latest}
environment:
SECRET_KEY: ${SECRET_KEY:?Secret key must be set}
SENTRY_DSN: ${SENTRY_DSN}
POSTGRES_HOST: postgres
POSTGRES_DB: thaliany
POSTGRES_USER: thaliany
Expand Down
6 changes: 3 additions & 3 deletions server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ django-cors-headers==4.3.1
django-rest-framework==0.1.0
django-sendfile==0.3.11
djangorestframework==3.15.1
gunicorn==22.0.0
idna==3.7
packaging==24.0
requests==2.31.0
sentry-sdk==2.1.1
sqlparse==0.5.0
urllib3==2.2.1
gunicorn==22.0.0
psycopg2-binary==2.9.9
pyjwt==2.8.0
11 changes: 11 additions & 0 deletions server/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
import os
from pathlib import Path

if os.environ.get("SENTRY_DSN"):
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN"),
integrations=[DjangoIntegration()],
traces_sample_rate=0.2,
profiles_sample_rate=0.5,
)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

Expand Down

0 comments on commit 19b7e19

Please sign in to comment.