feat(sentry): add sentry support

This commit is contained in:
2026-11-21 11:23:57 +03:00
parent 0f2d9c2a1f
commit 92add88a7a
4 changed files with 30 additions and 7 deletions
+5
View File
@@ -19,3 +19,8 @@ app.add_middleware(
app.include_router(weather.router) app.include_router(weather.router)
app.include_router(schedule.router) app.include_router(schedule.router)
doc.mount(app, "/api") doc.mount(app, "/api")
@app.get("/error", include_in_schema=False)
def test_error():
raise RuntimeError("test")
+13
View File
@@ -1,6 +1,7 @@
from os import environ from os import environ
from pathlib import Path from pathlib import Path
import sentry_sdk
import uvicorn import uvicorn
from gallery.easel import build_app from gallery.easel import build_app
@@ -13,6 +14,18 @@ from gallery.painting.yandexweather.api import YandexWeatherApi
from gallery.sketch.bundle import ApiBundle from gallery.sketch.bundle import ApiBundle
from gallery.sketch.schedule.cached import CachedScheduleApi from gallery.sketch.schedule.cached import CachedScheduleApi
from gallery.sketch.weather.cached import CachedWeatherApi from gallery.sketch.weather.cached import CachedWeatherApi
from gallery.version import __version__
if sentry_dsn := environ.get("SENTRY_DSN"):
sentry_sdk.init(
sentry_dsn,
send_default_pii=True,
max_request_body_size="always",
release=__version__,
traces_sample_rate=0,
send_client_reports=False,
auto_session_tracking=False,
)
api = ApiBundle( api = ApiBundle(
[ [
Generated
+6 -6
View File
@@ -2797,15 +2797,15 @@ files = [
[[package]] [[package]]
name = "sentry-sdk" name = "sentry-sdk"
version = "2.64.0" version = "2.75.0"
description = "Python client for Sentry (https://sentry.io)" description = "Python client for Sentry (https://sentry.io)"
optional = true optional = true
python-versions = ">=3.6" python-versions = ">=3.6"
groups = ["main"] groups = ["main"]
markers = "extra == \"app\"" markers = "extra == \"app\""
files = [ files = [
{file = "sentry_sdk-2.64.0-py3-none-any.whl", hash = "sha256:715ea91ca860a819e8d8a50a7bde3a80d0df3b4ed7b6660a20fb9a2d084188f1"}, {file = "sentry_sdk-2.75.0-py3-none-any.whl", hash = "sha256:9a10e97de2cbd42ad7e4a6e02a0d5af19de9811eb02445077d41ba14c08e170c"},
{file = "sentry_sdk-2.64.0.tar.gz", hash = "sha256:68be2c29e14ae310f8a39e1a79916b6d85c6cb41dcce789d14ff05fe293e4c55"}, {file = "sentry_sdk-2.75.0.tar.gz", hash = "sha256:c38ac2d4b2435c11da821e173bb9d9088c98f41ae92f559ce0e424170a8e1a29"},
] ]
[package.dependencies] [package.dependencies]
@@ -2837,7 +2837,7 @@ huggingface-hub = ["huggingface_hub (>=0.22)"]
langchain = ["langchain (>=0.0.210)"] langchain = ["langchain (>=0.0.210)"]
langgraph = ["langgraph (>=0.6.6)"] langgraph = ["langgraph (>=0.6.6)"]
launchdarkly = ["launchdarkly-server-sdk (>=9.8.0)"] launchdarkly = ["launchdarkly-server-sdk (>=9.8.0)"]
litellm = ["litellm (>=1.77.5,!=1.82.7,!=1.82.8)"] litellm = ["litellm (>=1.77.5,!=1.82.7,!=1.82.8,!=1.107.0)"]
litestar = ["litestar (>=2.0.0)"] litestar = ["litestar (>=2.0.0)"]
loguru = ["loguru (>=0.5)"] loguru = ["loguru (>=0.5)"]
mcp = ["mcp (>=1.15.0)"] mcp = ["mcp (>=1.15.0)"]
@@ -3430,9 +3430,9 @@ multidict = ">=4.0"
propcache = ">=0.2.1" propcache = ">=0.2.1"
[extras] [extras]
app = ["babel", "fastapi", "jinja2"] app = ["babel", "fastapi", "jinja2", "sentry-sdk"]
[metadata] [metadata]
lock-version = "2.1" lock-version = "2.1"
python-versions = ">=3.14,<4.0" python-versions = ">=3.14,<4.0"
content-hash = "e72a18cf1ba7524566284f7992ea977bfa302fe8f451b6215ed882b43a5d7f95" content-hash = "4c29d348bc649dacbad9408a5ae723a39c59fad74881809374683956ea35bf6b"
+6 -1
View File
@@ -20,10 +20,15 @@ app = [
"fastapi[standard] (>=0.139,<0.140)", "fastapi[standard] (>=0.139,<0.140)",
"jinja2 (>=3.1,<4.0)", "jinja2 (>=3.1,<4.0)",
"babel (>=2.18,<3.0)", "babel (>=2.18,<3.0)",
"sentry-sdk (>=2.75.0,<3.0.0)",
] ]
[dependency-groups] [dependency-groups]
test = ["pytest (>=9.1,<10.0)", "pytest-asyncio (>=1.4,<2.0)", "coverage (>=7.16.1,<8.0.0)"] test = [
"pytest (>=9.1,<10.0)",
"pytest-asyncio (>=1.4,<2.0)",
"coverage (>=7.16.1,<8.0.0)",
]
dev = ["pylint (>=4.0.6,<5.0.0)", "black (>=26.5,<27.0)", "isort (>=8.0,<9.0)"] dev = ["pylint (>=4.0.6,<5.0.0)", "black (>=26.5,<27.0)", "isort (>=8.0,<9.0)"]
[project.scripts] [project.scripts]