From 5015d760dbf6677d59490b3ef3703400880467f9 Mon Sep 17 00:00:00 2001 From: Chris Mutel Date: Thu, 29 Oct 2026 17:01:55 +0100 Subject: [PATCH] refactor: remove Sentry integration, keep error-monitoring entry point Drop sentry_sdk and its init call. SENTRY_DSN becomes ERROR_MONITORING_DSN, which settings.py reads and reports on but does not wire to any service, so the guarded init block remains as the place to plug in a future backend. Co-Authored-By: Claude --- .env.SAMPLE | 3 ++- CHANGES.md | 4 ++++ conftest.py | 2 +- dds_registration/settings.py | 26 +++++++++++--------------- pyproject.toml | 1 - tests/test_cookie_settings.py | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.env.SAMPLE b/.env.SAMPLE index 3e36cfa..7ab3126 100644 --- a/.env.SAMPLE +++ b/.env.SAMPLE @@ -6,4 +6,5 @@ DEFAULT_FROM_EMAIL="user@example.com" STRIPE_PAYMENT_PRODUCT_NAME="SAMPLE" STRIPE_PUBLISHABLE_KEY="SAMPLE" STRIPE_SECRET_KEY="SAMPLE" -SENTRY_DSN="https://..." +# Optional. No backend is wired up yet; see the error-monitoring block in settings.py. +ERROR_MONITORING_DSN="" diff --git a/CHANGES.md b/CHANGES.md index 8db8fe3..d9658bb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Removed + +- Sentry integration and the `sentry_sdk` dependency. The `SENTRY_DSN` setting is replaced by `ERROR_MONITORING_DSN`, which is read but not wired to any service; the init block in `settings.py` is kept as the entry point for a future error-monitoring backend. + ### Added - Membership `started`/`until` are dates; membership runs one year from joining and early renewal extends from the current end date (admins can edit both dates). Existing rows migrate to `until = Dec 31 of the stored year`. diff --git a/conftest.py b/conftest.py index 7080acf..e90d722 100644 --- a/conftest.py +++ b/conftest.py @@ -23,7 +23,7 @@ "STRIPE_PAYMENT_PRODUCT_NAME": "test-product", "SLACK_PAYMENTS_WEBHOOK": "", "SLACK_REGISTRATIONS_WEBHOOK": "", - "SENTRY_DSN": "", + "ERROR_MONITORING_DSN": "", "DEFAULT_FROM_EMAIL": "test@example.com", "CELERY_TASK_ALWAYS_EAGER": "True", "CELERY_BROKER_URL": "memory://", diff --git a/dds_registration/settings.py b/dds_registration/settings.py index a9cdec4..ef7b3d1 100644 --- a/dds_registration/settings.py +++ b/dds_registration/settings.py @@ -7,7 +7,6 @@ from pathlib import Path import environ -import sentry_sdk from celery.schedules import crontab from loguru import logger @@ -42,7 +41,7 @@ def random_string(length: int = 32) -> str: STRIPE_SECRET_KEY=(str, ""), SLACK_PAYMENTS_WEBHOOK=(str, ""), SLACK_REGISTRATIONS_WEBHOOK=(str, ""), - SENTRY_DSN=(str, ""), + ERROR_MONITORING_DSN=(str, ""), CELERY_BROKER_URL=(str, "redis://127.0.0.1:6379/2"), CELERY_TASK_ALWAYS_EAGER=(bool, False), ) @@ -66,7 +65,7 @@ def random_string(length: int = 32) -> str: STRIPE_SECRET_KEY = env("STRIPE_SECRET_KEY") SLACK_PAYMENTS_WEBHOOK = env("SLACK_PAYMENTS_WEBHOOK") SLACK_REGISTRATIONS_WEBHOOK = env("SLACK_REGISTRATIONS_WEBHOOK") -SENTRY_DSN = env("SENTRY_DSN") +ERROR_MONITORING_DSN = env("ERROR_MONITORING_DSN") # Build paths inside the project like this: BASE_DIR / 'subdir'. # Static files (CSS, JavaScript, Images) @@ -370,16 +369,13 @@ def random_string(length: int = 32) -> str: "SITE_KEYWORDS": SITE_KEYWORDS, } -if SENTRY_DSN: - sentry_sdk.init( - dsn=SENTRY_DSN, - # Set traces_sample_rate to 1.0 to capture 100% - # of transactions for performance monitoring. - traces_sample_rate=1.0, - # Set profiles_sample_rate to 1.0 to profile 100% - # of sampled transactions. - # We recommend adjusting this value in production. - profiles_sample_rate=1.0, - ) +# Error-monitoring entry point. +# +# Sentry was removed (see CHANGES.md). If another service (Sentry, GlitchTip, Rollbar, +# ...) is wanted later, initialise its SDK here, guarded by +# ERROR_MONITORING_DSN. Nothing is wired up at the moment, so a non-empty DSN +# is reported but otherwise ignored. +if ERROR_MONITORING_DSN: + logger.warning("ERROR_MONITORING_DSN is set but no error-monitoring backend is configured") else: - logger.info("No key for Sentry found") + logger.info("No error-monitoring DSN configured") diff --git a/pyproject.toml b/pyproject.toml index c3d8813..3974956 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,6 @@ dependencies = [ "qrcode", "qrcode", "requests", - "sentry_sdk", "stripe>=8.9.0", "xlsxwriter", ] diff --git a/tests/test_cookie_settings.py b/tests/test_cookie_settings.py index 3a69677..57eacbb 100644 --- a/tests/test_cookie_settings.py +++ b/tests/test_cookie_settings.py @@ -28,7 +28,7 @@ "STRIPE_PAYMENT_PRODUCT_NAME": "x", "SLACK_PAYMENTS_WEBHOOK": "x", "SLACK_REGISTRATIONS_WEBHOOK": "x", - "SENTRY_DSN": "", + "ERROR_MONITORING_DSN": "", "DEFAULT_FROM_EMAIL": "x@example.com", } @@ -61,7 +61,7 @@ def _load_settings(*, debug: bool) -> dict: text=True, check=True, ) - # settings.py logs a Sentry line to stderr; the JSON is the last stdout line. + # settings.py logs an error-monitoring line to stderr; the JSON is the last stdout line. return json.loads(out.stdout.strip().splitlines()[-1])