diff --git a/backend/chat_service.py b/backend/chat_service.py index 673166a2e..ba540bbc9 100644 --- a/backend/chat_service.py +++ b/backend/chat_service.py @@ -20,14 +20,6 @@ from routes.misc_routes import misc_router logger = get_logger(__name__) -sentry_dsn = os.getenv("SENTRY_DSN") -if sentry_dsn: - sentry_sdk.init( - dsn=sentry_dsn, - traces_sample_rate=0.1, - profiles_sample_rate=0.1, - ) - app = FastAPI() add_cors_middleware(app) diff --git a/backend/crawl_service.py b/backend/crawl_service.py index b9537f49a..6c7988df5 100644 --- a/backend/crawl_service.py +++ b/backend/crawl_service.py @@ -1,4 +1,3 @@ -import os from packages.utils import handle_request_validation_error @@ -8,7 +7,6 @@ if __name__ == "__main__": from dotenv import load_dotenv # type: ignore load_dotenv() -import sentry_sdk from fastapi import FastAPI, HTTPException from fastapi.responses import JSONResponse from logger import get_logger @@ -17,15 +15,6 @@ from routes.crawl_routes import crawl_router from routes.misc_routes import misc_router logger = get_logger(__name__) - -sentry_dsn = os.getenv("SENTRY_DSN") -if sentry_dsn: - sentry_sdk.init( - dsn=sentry_dsn, - traces_sample_rate=0.1, - profiles_sample_rate=0.1, - ) - app = FastAPI() add_cors_middleware(app) diff --git a/backend/main.py b/backend/main.py index 55b60b17e..51fcd5bbc 100644 --- a/backend/main.py +++ b/backend/main.py @@ -27,6 +27,8 @@ from routes.misc_routes import misc_router from routes.notification_routes import notification_router from routes.subscription_routes import subscription_router from routes.upload_routes import upload_router +from sentry_sdk.integrations.starlette import StarletteIntegration +from sentry_sdk.integrations.fastapi import FastApiIntegration logger = get_logger(__name__) @@ -41,8 +43,18 @@ sentry_dsn = os.getenv("SENTRY_DSN") if sentry_dsn: sentry_sdk.init( dsn=sentry_dsn, - traces_sample_rate=0.1, - profiles_sample_rate=0.1, + traces_sample_rate=0.1, + profiles_sample_rate=0.1, + sample_rate=0.1, + enable_tracing=True, + integrations=[ + StarletteIntegration( + transaction_style="endpoint" + ), + FastApiIntegration( + transaction_style="endpoint" + ), + ] ) app = FastAPI() diff --git a/backend/requirements.txt b/backend/requirements.txt index 148bb6093..eb4730a74 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -13,13 +13,13 @@ fastapi==0.95.2 python-multipart==0.0.6 uvicorn==0.22.0 pypandoc==1.11 - docx2txt==0.8 python-jose==3.3.0 asyncpg==0.27.0 flake8==6.0.0 flake8-black==0.3.6 -sentry-sdk==1.26.0 +sentry-sdk==1.37.1 +sentry-sdk[fastapi]==1.37.1 pyright==1.1.316 resend==0.5.1 html5lib==1.1 diff --git a/backend/upload_service.py b/backend/upload_service.py index b2cbb5267..d776c07ac 100644 --- a/backend/upload_service.py +++ b/backend/upload_service.py @@ -18,15 +18,6 @@ from routes.misc_routes import misc_router from routes.upload_routes import upload_router logger = get_logger(__name__) - -sentry_dsn = os.getenv("SENTRY_DSN") -if sentry_dsn: - sentry_sdk.init( - dsn=sentry_dsn, - traces_sample_rate=0.1, - profiles_sample_rate=0.1, - ) - app = FastAPI()