feat(sentry): add Sentry error tracking to the Django services - #3007
Merged
Conversation
Adds sentry-sdk to the server and viewer dependency groups (plus the mypy group, since that CI job imports settings) and initialises it in the shared Django settings module, so anthias-server, anthias-celery, and the viewer all report crashes. - The DSN can be overridden via the SENTRY_DSN env var (pointing at an operator's own Sentry project), or set to an empty string to disable crash reporting entirely. - environment= mirrors the ENVIRONMENT env var (production default) so dev/CI events are filterable in Sentry. - release= comes from pyproject.toml's [project].version via the existing get_anthias_release() helper. - send_default_pii is gated on the existing analytics_opt_out knob in anthias.conf — opted-out devices still report crashes, but without request headers / IPs / user data. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds Sentry crash reporting across Anthias’ Django-based services by introducing sentry-sdk as a dependency and initializing it in the shared Django settings module loaded by anthias-server, anthias-celery, and anthias-viewer.
Changes:
- Add
sentry-sdk==2.61.1to the relevant dependency groups (server/viewer/mypy/test via includes) and lockfile. - Initialize
sentry_sdkinanthias_server.django_project.settingswith DSN/env overrides, environment tagging, release tagging, and conditional PII enrichment based onanalytics_opt_out.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
uv.lock |
Locks sentry-sdk==2.61.1 and includes it in the appropriate dependency groups. |
src/anthias_server/django_project/settings.py |
Initializes Sentry early during Django settings import with environment/release/PII configuration. |
pyproject.toml |
Adds sentry-sdk==2.61.1 to dependency groups used by runtime services and mypy CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The unit suite is built to run with no external network dependencies (conftest.py force-mocks Redis for the same reason), and exceptions raised on purpose by failing tests must not land in the production Sentry project. Default the DSN to empty under ENVIRONMENT=test or pytest (reusing the existing argv detector, moved up from the DATABASES section); an explicit SENTRY_DSN still wins so the integration stack can opt in deliberately. Addresses the Copilot review comment on the hardcoded default DSN. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Asserts the client has no DSN, builds no transport, and drops capture calls when running under pytest, so a future settings.py refactor can't silently re-enable sending from test runs. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
5 tasks
vpetersson
added a commit
that referenced
this pull request
Jun 7, 2026
- CalVer (YYYY.0M.MICRO); still June 2026, micro 1 -> 2 - Ships the Qt 6 video audio fix (#3001) — PulseAudio in the viewer container; videos were silent on pi4-64/pi5/x86/arm64 since the QtMultimedia migration - Adds the arm64/Qt6 pi3-64 board and the Rock Pi 4 fleet (#2985) - Page-load watchdog so a stalled fetch can't freeze the display (#3003), Sentry error tracking for the Django services (#3007) - Redis data persisted to the mounted volume so device identity survives recreation (#2983); unpinner also rolls OS + supervisor updates (#2984) - Streamed backup downloads (#3005), 12-hour AM/PM asset times (#3002), BuildKit frontend via mirror.gcr.io (#3008) Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issues Fixed
Not associated with an issue — adds crash reporting so fleet-wide errors surface in Sentry instead of only in device logs.
Description
Adds
sentry-sdk(2.61.1) and initialises it in the shared Django settings module, so anthias-server, anthias-celery, and anthias-viewer all report crashes (each service loads this module at boot viaDJANGO_SETTINGS_MODULE+django.setup()).SENTRY_DSNenv override — operators can point crash reporting at their own Sentry project, or set it to an empty string to disable sending entirely (verified: empty DSN → no transport, events dropped).environment=mirrors theENVIRONMENTenv var (productiondefault), so dev/CI events are filterable in Sentry.release=comes frompyproject.toml's[project].versionvia the existingget_anthias_release()helper (handles theuv sync --no-install-projectimage layout).analytics_opt_outknob inanthias.conf— the same one that gates GA telemetry. Opted-out devices still report crashes, just without request headers / IPs / user data.The dependency is added to the
serverandviewergroups, plus themypygroup (that CI job imports settings through the django-stubs plugin).Checklist
🤖 Generated with Claude Code