From c8b3ccce394dad01d3665c42687b5ce23ebf7f92 Mon Sep 17 00:00:00 2001 From: Esteban Maya Date: Thu, 28 Mar 2024 18:04:20 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=85=20Set=20up=20Sentry=20for=20FastAP?= =?UTF-8?q?I=20applications=20(#1136)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastián Ramírez --- backend/app/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/app/main.py b/backend/app/main.py index 849b545..a1d7e22 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -1,3 +1,4 @@ +import sentry_sdk from fastapi import FastAPI from fastapi.routing import APIRoute from starlette.middleware.cors import CORSMiddleware @@ -10,6 +11,9 @@ def custom_generate_unique_id(route: APIRoute) -> str: return f"{route.tags[0]}-{route.name}" +if settings.SENTRY_DSN: + sentry_sdk.init(dsn=str(settings.SENTRY_DSN), enable_tracing=True) + app = FastAPI( title=settings.PROJECT_NAME, openapi_url=f"{settings.API_V1_STR}/openapi.json",