From 35677161678b314b9a4a8618486f86e61b76abfe Mon Sep 17 00:00:00 2001 From: Andrew Weiland Date: Mon, 27 Jul 2026 10:05:10 -0400 Subject: [PATCH] Removing Sentry --- .github/workflows/_deploy.yaml | 1 - .github/workflows/_migrations.yaml | 1 - pyproject.toml | 1 - src/apps/answers/service.py | 3 +-- src/apps/answers/tasks.py | 6 ++---- src/apps/integrations/loris/service/loris.py | 3 +-- src/config/__init__.py | 4 ---- src/config/sentry.py | 5 ----- src/infrastructure/app.py | 4 ---- src/infrastructure/utility/redis_client.py | 9 +++------ uv.lock | 15 --------------- 11 files changed, 7 insertions(+), 45 deletions(-) delete mode 100644 src/config/sentry.py diff --git a/.github/workflows/_deploy.yaml b/.github/workflows/_deploy.yaml index 2292cbf5434f..5f11b226cd63 100644 --- a/.github/workflows/_deploy.yaml +++ b/.github/workflows/_deploy.yaml @@ -86,7 +86,6 @@ jobs: environment-variables: | VERSION=${{ inputs.image-tag }} DD_VERSION=${{ inputs.image-tag }} - SENTRY_RELEASE=${{ inputs.image-tag }} COMMIT_ID=${{ github.sha }} docker-labels: | com.datadoghq.tags.version=${{ inputs.image-tag }} diff --git a/.github/workflows/_migrations.yaml b/.github/workflows/_migrations.yaml index 5aea200a718c..89cbd38f9f17 100644 --- a/.github/workflows/_migrations.yaml +++ b/.github/workflows/_migrations.yaml @@ -58,7 +58,6 @@ jobs: environment-variables: | VERSION=${{ inputs.image-tag }} DD_VERSION=${{ inputs.image-tag }} - SENTRY_RELEASE=${{ inputs.image-tag }} docker-labels: | com.datadoghq.tags.version=${{ inputs.image-tag }} diff --git a/pyproject.toml b/pyproject.toml index 84f1ddfe50b7..b70d471f5ba3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,6 @@ dependencies = [ "python-multipart>=0.0.31", "python-slugify==8.0.4", "redis==5.2.*", - "sentry-sdk~=2.13", "sqlalchemy[asyncio]~=1.4.53", "sqlalchemy-utils~=0.41.2", "structlog~=25.4.0", diff --git a/src/apps/answers/service.py b/src/apps/answers/service.py index 7a62fbc27cb4..7f7f825da5bd 100644 --- a/src/apps/answers/service.py +++ b/src/apps/answers/service.py @@ -12,7 +12,6 @@ from typing import Callable, List, Mapping import aiohttp -import sentry_sdk from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import padding @@ -1727,7 +1726,7 @@ async def _create_alerts( ).model_dump(), ) except Exception as e: - sentry_sdk.capture_exception(e) + logger.exception(str(e)) break await self.send_alert_mail(persons) diff --git a/src/apps/answers/tasks.py b/src/apps/answers/tasks.py index 72c37e4f29f0..19a4d96ab35d 100644 --- a/src/apps/answers/tasks.py +++ b/src/apps/answers/tasks.py @@ -1,9 +1,7 @@ import base64 import io -import traceback import uuid -import sentry_sdk from fastapi import UploadFile from sqlalchemy.ext.asyncio import AsyncSession @@ -13,6 +11,7 @@ from apps.mailing.services import MailingService from broker import broker from infrastructure.database import session_manager +from infrastructure.logger import logger # moved from previous implementation @@ -64,5 +63,4 @@ async def create_report( ) ) except Exception as e: - traceback.print_exception(e) - sentry_sdk.capture_exception(e) + logger.exception(str(e)) diff --git a/src/apps/integrations/loris/service/loris.py b/src/apps/integrations/loris/service/loris.py index 8f39d468dc32..0ef658b5877e 100644 --- a/src/apps/integrations/loris/service/loris.py +++ b/src/apps/integrations/loris/service/loris.py @@ -7,7 +7,6 @@ from collections import defaultdict import aiohttp -import sentry_sdk from pydantic.json import pydantic_encoder from apps.activities.crud.activity_history import ActivityHistoriesCRUD @@ -890,7 +889,7 @@ async def _create_integration_alerts(self, applet_id: uuid.UUID, message: str): ) except Exception as e: - sentry_sdk.capture_exception(e) + logger.exception(str(e)) break async def create_loris_integration(self, hostname, username, project, password) -> LorisIntegration: diff --git a/src/config/__init__.py b/src/config/__init__.py index ca970497c4db..5d616082ec65 100644 --- a/src/config/__init__.py +++ b/src/config/__init__.py @@ -23,7 +23,6 @@ from config.rabbitmq import RabbitMQSettings from config.redis import RedisSettings from config.secret import SecretSettings -from config.sentry import SentrySettings from config.service import JsonLdConverterSettings, ServiceSettings from config.superuser import SuperAdmin from config.task import AnswerEncryption, AudioFileConvert, ImageConvert @@ -71,9 +70,6 @@ class Settings(BaseSettings): # CDN configs cdn: CDNSettings = CDNSettings() - # Sentry stuff - sentry: SentrySettings = SentrySettings() - # FCM Notification configs fcm: FirebaseCloudMessagingSettings = FirebaseCloudMessagingSettings() diff --git a/src/config/sentry.py b/src/config/sentry.py deleted file mode 100644 index e071b18c8712..000000000000 --- a/src/config/sentry.py +++ /dev/null @@ -1,5 +0,0 @@ -from pydantic import BaseModel - - -class SentrySettings(BaseModel): - dsn: str = "" diff --git a/src/infrastructure/app.py b/src/infrastructure/app.py index 1811ab2b4659..980cb6a10024 100644 --- a/src/infrastructure/app.py +++ b/src/infrastructure/app.py @@ -1,6 +1,5 @@ from typing import Iterable, Type -import sentry_sdk from asgi_correlation_id import CorrelationIdMiddleware from asyncpg import InvalidPasswordError from fastapi import FastAPI @@ -111,9 +110,6 @@ def create_app(): lifespan=lifespan, ) - if settings.sentry.dsn: - sentry_sdk.init(dsn=settings.sentry.dsn, traces_sample_rate=1.0) - # Include routers for router in routers: app.include_router(router) diff --git a/src/infrastructure/utility/redis_client.py b/src/infrastructure/utility/redis_client.py index cd73b07d4309..92dcfb792933 100644 --- a/src/infrastructure/utility/redis_client.py +++ b/src/infrastructure/utility/redis_client.py @@ -5,9 +5,9 @@ import redis.asyncio as redis from redis.typing import EncodableT -from sentry_sdk import capture_exception from config import settings +from infrastructure.logger import logger class RedisCacheTest: @@ -139,11 +139,8 @@ def _start(self): db=self.db, **self.configuration, ) - except redis.exceptions.ConnectionError as e: - try: - capture_exception(e) - except ImportError: - print(e) + except redis.ConnectionError as e: + logger.exception(str(e)) async def get(self, key: str) -> typing.Optional[str]: if not self._cache: diff --git a/uv.lock b/uv.lock index 2cacbef5879e..957086ff168b 100644 --- a/uv.lock +++ b/uv.lock @@ -577,7 +577,6 @@ dependencies = [ { name = "python-slugify" }, { name = "redis" }, { name = "regex" }, - { name = "sentry-sdk" }, { name = "sqlalchemy", extra = ["asyncio"] }, { name = "sqlalchemy-utils" }, { name = "structlog" }, @@ -644,7 +643,6 @@ requires-dist = [ { name = "python-slugify", specifier = "==8.0.4" }, { name = "redis", specifier = "==5.2.*" }, { name = "regex", specifier = ">=2025.11.3" }, - { name = "sentry-sdk", specifier = "~=2.13" }, { name = "sqlalchemy", extras = ["asyncio"], specifier = "~=1.4.53" }, { name = "sqlalchemy-utils", specifier = "~=0.41.2" }, { name = "structlog", specifier = "~=25.4.0" }, @@ -2244,19 +2242,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/48/f0/ae7ca09223a81a1d890b2557186ea015f6e0502e9b8cb8e1813f1d8cfa4e/s3transfer-0.14.0-py3-none-any.whl", hash = "sha256:ea3b790c7077558ed1f02a3072fb3cb992bbbd253392f4b6e9e8976941c7d456", size = 85712, upload-time = "2025-09-09T19:23:30.041Z" }, ] -[[package]] -name = "sentry-sdk" -version = "2.33.2" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "certifi" }, - { name = "urllib3" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b0/82/dfe4a91fd38e048fbb55ca6c072710408e8802015aa27cde18e8684bb1e9/sentry_sdk-2.33.2.tar.gz", hash = "sha256:e85002234b7b8efac9b74c2d91dbd4f8f3970dc28da8798e39530e65cb740f94", size = 335804, upload-time = "2025-07-22T10:41:18.578Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c2/dc/4d825d5eb6e924dfcc6a91c8185578a7b0a5c41fd2416a6f49c8226d6ef9/sentry_sdk-2.33.2-py2.py3-none-any.whl", hash = "sha256:8d57a3b4861b243aa9d558fda75509ad487db14f488cbdb6c78c614979d77632", size = 356692, upload-time = "2025-07-22T10:41:16.531Z" }, -] - [[package]] name = "setuptools" version = "83.0.0"