Skip to content

Commit

Permalink
chore: Sentry configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Aug 28, 2024
1 parent b4fff10 commit fec4a55
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
echo 'ALLOWED_HOSTS=openfoodfacts-explorer.vercel.app,prices.openfoodfacts.net,prices.openfoodfacts.org' >> .env
echo "OAUTH2_SERVER_URL=https://world.openfoodfacts.org/cgi/auth.pl" >> .env
echo "SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }}" >> .env
echo "SENTRY_DNS=${{ secrets.SENTRY_DSN }}" >> .env
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env
echo "POSTGRES_EXPOSE=127.0.0.1:5433" >> .env
echo "POSTGRES_HOST=postgres.open_prices_default" >> .env
echo "POSTGRES_DB=postgres" >> .env
Expand Down
19 changes: 19 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,25 @@
}


# Sentry
# https://docs.sentry.io/platforms/python/integrations/django/
# ------------------------------------------------------------------------------

if not DEBUG:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
dsn=os.getenv("SENTRY_DSN"),
integrations=[DjangoIntegration()],
# Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. # noqa
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100% of sampled transactions. # noqa
# We recommend adjusting this value in production.
# profiles_sample_rate=1.0,
)


# Django Debug Toolbar
# https://django-debug-toolbar.readthedocs.io/
# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ x-api-common: &api-common
- DEBUG
- ALLOWED_HOSTS
- OAUTH2_SERVER_URL
- SENTRY_DNS
- SENTRY_DSN
- LOG_LEVEL
networks:
- default
Expand Down
100 changes: 52 additions & 48 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ openfoodfacts = "0.2.1"
psycopg2-binary = "~2.9.9"
python-multipart = "~0.0.7"
requests = "~2.31.0"
sentry-sdk = {extras = ["fastapi"], version = "~1.35.0"}
osmpythontools = "^0.3.5"
typer = "~0.9.0"
django = "^5.0.7"
Expand All @@ -66,6 +65,7 @@ blessed = "^1.20.0"
ipython = "^8.26.0"
gunicorn = "^22.0.0"
django-cors-headers = "^4.4.0"
sentry-sdk = {extras = ["django"], version = "^2.13.0"}

[tool.poetry.group.dev.dependencies]
black = "~23.12.1"
Expand Down

0 comments on commit fec4a55

Please sign in to comment.