Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import datetime
from typing import Any

import sentry_sdk
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
Expand Down Expand Up @@ -40,6 +41,14 @@ def render(self, content: Any) -> bytes:
).encode("utf-8")


if settings.sentry_dsn:
sentry_sdk.init(
dsn=settings.sentry_dsn,
environment=settings.environment,
traces_sample_rate=settings.sentry_traces_sample_rate,
send_default_pii=False,
)

app = FastAPI(
title=settings.app_name,
version=settings.version,
Expand Down
7 changes: 7 additions & 0 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,12 @@ class Settings(BaseSettings):
# Production restrictions
disable_publisher_api: bool = False # Set to true in production

# Environment
environment: str = "development" # development, staging, production

# Sentry
sentry_dsn: str | None = None
sentry_traces_sample_rate: float = 0.1


settings = Settings()
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies = [
"pyjwt[crypto]>=2.10.0",
"python-multipart>=0.0.9",
"redis>=5.2.0",
"sentry-sdk>=2.52.0",
"signedshot>=0.1.0",
"slowapi>=0.1.9",
"sqlalchemy[asyncio]>=2.0.0",
Expand Down
15 changes: 15 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.