Add Sentry SDK integration for error tracking (GlitchTip-compatible) #109

Closed
opened 2026-10-02 21:01:39 +00:00 by hobbypunk · 0 comments
Owner

Summary

Add opt-in error tracking to the base app via the official Sentry SDKs (sentry-ruby + sentry-rails). The integration must be receiver-neutral: any Sentry-DSN-compatible backend works (self-hosted GlitchTip, Bugsink, or Sentry SaaS).

Background / Decision

  • Evaluated error tracking options: Sentry self-hosted (too heavy, ~20 containers), SigNoz/OTel (OTel-native but requires ClickHouse-based stack – too heavy for TrueNAS), GlitchTip (lightweight, ~3 containers).
  • Decision: Sentry SDKs in the app + self-hosted GlitchTip (Postgres + Valkey) on TrueNAS.
  • Sentry SDK protocol is the de-facto standard; switching to an OTel backend later is a receiver change, not a code rewrite.

Tasks

App integration

  • Add sentry-ruby + sentry-rails gems (production + development groups)
  • config/settings.yml: new sentry: section (dsn: (empty = disabled), environment:, traces_sample_rate:, profiles_sample_rate:)
  • config/initializers/sentry.rb: only initialize when DSN is present; breadcrumbs_logger (ActiveSupport + http), send_default_pii: false
  • User context via Current (only id + username, no email – privacy) via before_send or controller callback
  • Configure SETTINGS_SENTRY_DSN env var passthrough (Kamal/Docker)
  • README: document settings + env vars

GlitchTip deployment (TrueNAS)

  • Provide Compose template (glitchtip, postgres, valkey) with healthchecks + volumes
  • Document TrueNAS deployment (Custom App / Compose), project + DSN creation

Quality

  • Test: app boots cleanly with empty DSN (opt-in must not break anything)
  • Test: initializer configures Sentry correctly when DSN is set
  • .opencode-changes.md + CHANGELOG if applicable

Acceptance Criteria

  • App runs identically without DSN set (base app stays opt-in only)
  • With SETTINGS_SENTRY_DSN set, exceptions (controller + jobs) are reported to the DSN target
  • No PII (email, params beyond defaults) transmitted
  • Docs cover both GlitchTip self-hosting and Sentry SaaS as receiver

Notes

## Summary Add opt-in error tracking to the base app via the official Sentry SDKs (`sentry-ruby` + `sentry-rails`). The integration must be receiver-neutral: any Sentry-DSN-compatible backend works (self-hosted **GlitchTip**, Bugsink, or Sentry SaaS). ## Background / Decision - Evaluated error tracking options: Sentry self-hosted (too heavy, ~20 containers), SigNoz/OTel (OTel-native but requires ClickHouse-based stack – too heavy for TrueNAS), GlitchTip (lightweight, ~3 containers). - **Decision:** Sentry SDKs in the app + self-hosted GlitchTip (Postgres + Valkey) on TrueNAS. - Sentry SDK protocol is the de-facto standard; switching to an OTel backend later is a receiver change, not a code rewrite. ## Tasks ### App integration - [ ] Add `sentry-ruby` + `sentry-rails` gems (production + development groups) - [ ] `config/settings.yml`: new `sentry:` section (`dsn:` (empty = disabled), `environment:`, `traces_sample_rate:`, `profiles_sample_rate:`) - [ ] `config/initializers/sentry.rb`: only initialize when DSN is present; `breadcrumbs_logger` (ActiveSupport + http), `send_default_pii: false` - [ ] User context via `Current` (only `id` + `username`, **no email** – privacy) via `before_send` or controller callback - [ ] Configure `SETTINGS_SENTRY_DSN` env var passthrough (Kamal/Docker) - [ ] README: document settings + env vars ### GlitchTip deployment (TrueNAS) - [ ] Provide Compose template (glitchtip, postgres, valkey) with healthchecks + volumes - [ ] Document TrueNAS deployment (Custom App / Compose), project + DSN creation ### Quality - [ ] Test: app boots cleanly with empty DSN (opt-in must not break anything) - [ ] Test: initializer configures Sentry correctly when DSN is set - [ ] `.opencode-changes.md` + CHANGELOG if applicable ## Acceptance Criteria - App runs identically without DSN set (base app stays opt-in only) - With `SETTINGS_SENTRY_DSN` set, exceptions (controller + jobs) are reported to the DSN target - No PII (email, params beyond defaults) transmitted - Docs cover both GlitchTip self-hosting and Sentry SaaS as receiver ## Notes - Branch naming per convention: `feature/<issue>_sentry_integration` - Reference: https://glitchtip.com, https://github.com/getsentry/sentry-ruby
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hobbypunk/rails-base_app#109
No description provided.