feat(tradein): enrich GlitchTip SDK init — integrations + PII scrub (#396) #643

Merged
Light1YT merged 1 commit from feat/396-glitchtip-integrations into main 2026-05-29 09:23:17 +00:00
Owner

Summary

Advances #396. The tradein GlitchTip init was barebones (no integrations) → FastAPI request errors + logged ERRORs were NOT auto-captured. Enriched so monitoring actually works once an operator sets GLITCHTIP_DSN:

  • integrations: Starlette + FastApi (request errors), SQLAlchemy + Httpx (breadcrumbs), Logging(event_level=ERROR → logger.error becomes events)
  • release tag (GIT_SHA/SENTRY_RELEASE)
  • before_send=scrub_pii_event — redacts consumer PII (client_name/phone/email) from error event bodies (request.data/extra/contexts), beyond send_default_pii=False
  • NO CeleryIntegration (prod runs no celery worker — in-app scheduler)

code-reviewer (verified on sentry-sdk 2.60: guard intact = no-op while DSN empty, integrations correct, scrubber sound + always returns event, celery-omission matches compose topology).

⚠️ Still blocked on operator (the remaining #396 work — NOT in this PR)

Monitoring stays OFF until a DSN exists. Operator must: (1) create a GlitchTip project for tradein in the GlitchTip UI → get its DSN; (2) write GLITCHTIP_DSN=... into prod tradein-mvp/backend/.env.runtime; (3) recreate backend. NB: glitchtip-web shows unhealthy but is actually UP — its healthcheck probes /api/0/ with a method GlitchTip rejects (Method Not Allowed spam in logs) → false-unhealthy, separate devops fix.

Test plan

  • 8 unit tests (scrub_pii_event), ruff clean, py_compile clean
  • guard preserved → no-op while DSN empty (safe deploy now)
  • Post-DSN smoke: trigger a 500 + logger.error → events arrive in GlitchTip with PII redacted

Closes #396

## Summary Advances #396. The tradein GlitchTip init was barebones (no integrations) → FastAPI request errors + logged ERRORs were NOT auto-captured. Enriched so monitoring actually works once an operator sets `GLITCHTIP_DSN`: - **integrations**: Starlette + FastApi (request errors), SQLAlchemy + Httpx (breadcrumbs), Logging(event_level=ERROR → logger.error becomes events) - **release** tag (GIT_SHA/SENTRY_RELEASE) - **before_send=scrub_pii_event** — redacts consumer PII (client_name/phone/email) from error event bodies (request.data/extra/contexts), beyond send_default_pii=False - **NO CeleryIntegration** (prod runs no celery worker — in-app scheduler) code-reviewer ✅ (verified on sentry-sdk 2.60: guard intact = no-op while DSN empty, integrations correct, scrubber sound + always returns event, celery-omission matches compose topology). ## ⚠️ Still blocked on operator (the remaining #396 work — NOT in this PR) Monitoring stays OFF until a DSN exists. Operator must: (1) create a GlitchTip **project** for tradein in the GlitchTip UI → get its DSN; (2) write `GLITCHTIP_DSN=...` into prod `tradein-mvp/backend/.env.runtime`; (3) recreate backend. NB: `glitchtip-web` shows **unhealthy** but is actually UP — its healthcheck probes `/api/0/` with a method GlitchTip rejects (`Method Not Allowed` spam in logs) → false-unhealthy, separate devops fix. ## Test plan - [x] 8 unit tests (scrub_pii_event), ruff clean, py_compile clean - [x] guard preserved → no-op while DSN empty (safe deploy now) - [ ] Post-DSN smoke: trigger a 500 + logger.error → events arrive in GlitchTip with PII redacted Closes #396
Light1YT added 1 commit 2026-05-29 09:23:06 +00:00
The tradein GlitchTip init was barebones (dsn/environment/traces/pii only) —
no integrations, so FastAPI request errors and logged ERRORs were not
auto-captured. Enrich it so real error monitoring works once GLITCHTIP_DSN
is set:
- integrations: Starlette, FastApi (request errors), SQLAlchemy, Httpx
  (breadcrumbs), Logging(level=INFO, event_level=ERROR → logger.error events)
- release tag (GIT_SHA / SENTRY_RELEASE / "unknown")
- before_send=scrub_pii_event — redacts consumer PII (client_name/phone/email)
  from error event bodies (request.data / extra / contexts), beyond what
  send_default_pii=False covers
- NO CeleryIntegration (prod runs no celery worker; in-app scheduler)

Guard preserved: full no-op while GLITCHTIP_DSN is empty (current prod) →
safe to deploy now; activates when an operator sets the DSN.

Closes #396
Light1YT merged commit af6278eaee into main 2026-05-29 09:23:17 +00:00
Light1YT deleted branch feat/396-glitchtip-integrations 2026-05-29 09:23:18 +00:00
Sign in to join this conversation.
No reviewers
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: lekss361/gendesign#643
No description provided.