feat: init sentry monitoring

This commit is contained in:
swve 2023-04-13 20:06:09 +02:00 committed by Badr B
parent 43d2b469a4
commit 137a909347
13 changed files with 1064 additions and 30 deletions

16
src/core/events/sentry.py Normal file
View file

@ -0,0 +1,16 @@
from fastapi import FastAPI
import sentry_sdk
from config.config import LearnHouseConfig
async def init_sentry(app: FastAPI) -> None:
leanrhouse_config : LearnHouseConfig = app.learnhouse_config # type: ignore
if leanrhouse_config.hosting_config.sentry_config is not None:
sentry_sdk.init(
dsn=app.learnhouse_config.hosting_config.sentry_config.dsn, # type: ignore
environment=app.learnhouse_config.hosting_config.sentry_config.environment, # type: ignore
release=app.learnhouse_config.hosting_config.sentry_config.release, # type: ignore
traces_sample_rate=1.0,
)