Skip to content

Commit 2539b22

Browse files
committed
Add Sentry support
Add optional support for reporting errors to Sentry.
1 parent 1f15364 commit 2539b22

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### New features
2+
3+
- Add support for reporting errors to Sentry in the frontend. Sentry support is not enabled in the workers for now since they run on a different Python stack and do not necessarily have Safir.

src/vocutouts/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@
1717
from safir.logging import Profile, configure_logging, configure_uvicorn_logging
1818
from safir.middleware.x_forwarded import XForwardedMiddleware
1919
from safir.models import ErrorModel
20+
from safir.sentry import initialize_sentry
2021
from safir.slack.webhook import SlackRouteErrorHandler
2122

23+
from . import __version__
2224
from .config import config, uws
2325
from .handlers import external, internal
2426

2527
__all__ = ["app"]
2628

2729

30+
initialize_sentry(release=__version__)
31+
32+
2833
@asynccontextmanager
2934
async def _lifespan(app: FastAPI) -> AsyncGenerator[None]:
3035
"""Set up and tear down the application."""

src/vocutouts/workers/uws.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44

55
import structlog
66
from safir.logging import configure_logging
7+
from safir.sentry import initialize_sentry
78

9+
from .. import __version__
810
from ..config import config, uws
911

1012
__all__ = ["WorkerSettings"]
1113

1214

15+
initialize_sentry(release=__version__)
16+
1317
configure_logging(
1418
name="vocutouts", profile=config.log_profile, log_level=config.log_level
1519
)

0 commit comments

Comments
 (0)