diff --git a/changelog.d/20251201_092825_rra_DM_52929.md b/changelog.d/20251201_092825_rra_DM_52929.md new file mode 100644 index 0000000..6554fd6 --- /dev/null +++ b/changelog.d/20251201_092825_rra_DM_52929.md @@ -0,0 +1,3 @@ +### New features + +- 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. diff --git a/src/vocutouts/main.py b/src/vocutouts/main.py index 94cb93c..1e23857 100644 --- a/src/vocutouts/main.py +++ b/src/vocutouts/main.py @@ -17,14 +17,19 @@ from safir.logging import Profile, configure_logging, configure_uvicorn_logging from safir.middleware.x_forwarded import XForwardedMiddleware from safir.models import ErrorModel +from safir.sentry import initialize_sentry from safir.slack.webhook import SlackRouteErrorHandler +from . import __version__ from .config import config, uws from .handlers import external, internal __all__ = ["app"] +initialize_sentry(release=__version__) + + @asynccontextmanager async def _lifespan(app: FastAPI) -> AsyncGenerator[None]: """Set up and tear down the application.""" diff --git a/src/vocutouts/workers/uws.py b/src/vocutouts/workers/uws.py index 1ad5ca6..e118095 100644 --- a/src/vocutouts/workers/uws.py +++ b/src/vocutouts/workers/uws.py @@ -4,12 +4,16 @@ import structlog from safir.logging import configure_logging +from safir.sentry import initialize_sentry +from .. import __version__ from ..config import config, uws __all__ = ["WorkerSettings"] +initialize_sentry(release=__version__) + configure_logging( name="vocutouts", profile=config.log_profile, log_level=config.log_level )