Integrate Sentry for error tracking and performance monitoring

This commit is contained in:
2025-02-10 04:56:55 +01:00
parent e7b1041f9e
commit cd649f37e8
3 changed files with 11 additions and 1 deletions

View File

@ -12,6 +12,7 @@ from functools import lru_cache
from typing import TYPE_CHECKING, Annotated, cast from typing import TYPE_CHECKING, Annotated, cast
import httpx import httpx
import sentry_sdk
import uvicorn import uvicorn
from apscheduler.schedulers.asyncio import AsyncIOScheduler from apscheduler.schedulers.asyncio import AsyncIOScheduler
from fastapi import FastAPI, Form, HTTPException, Request from fastapi import FastAPI, Form, HTTPException, Request
@ -947,7 +948,13 @@ def modify_webhook(old_hook: Annotated[str, Form()], new_hook: Annotated[str, Fo
if __name__ == "__main__": if __name__ == "__main__":
# TODO(TheLovinator): Make this configurable. sentry_sdk.init(
dsn="https://6e77a0d7acb9c7ea22e85a375e0ff1f4@o4505228040339456.ingest.us.sentry.io/4508792887967744",
send_default_pii=True,
traces_sample_rate=1.0,
_experiments={"continuous_profiling_auto_start": True},
)
uvicorn.run( uvicorn.run(
"main:app", "main:app",
log_level="info", log_level="info",

View File

@ -16,6 +16,7 @@ dependencies = [
"python-dotenv", "python-dotenv",
"python-multipart", "python-multipart",
"reader", "reader",
"sentry-sdk[fastapi]",
"uvicorn", "uvicorn",
] ]
@ -41,6 +42,7 @@ platformdirs = "*"
python-dotenv = "*" python-dotenv = "*"
python-multipart = "*" python-multipart = "*"
reader = "*" reader = "*"
sentry-sdk = {version = "*", extras = ["fastapi"]}
uvicorn = "*" uvicorn = "*"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]

View File

@ -9,4 +9,5 @@ platformdirs
python-dotenv python-dotenv
python-multipart python-multipart
reader reader
sentry-sdk[fastapi]
uvicorn uvicorn