Browse Source
🥅 Set up Sentry for FastAPI applications (#1136)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
pull/13907/head
Esteban Maya
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
4 additions and
0 deletions
-
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", |
|
|
|