Skip to content

Add Sentry error tracking and performance tracing#206

Open
jakebromberg wants to merge 1 commit intomainfrom
feat/sentry-tracing
Open

Add Sentry error tracking and performance tracing#206
jakebromberg wants to merge 1 commit intomainfrom
feat/sentry-tracing

Conversation

@jakebromberg
Copy link
Member

Summary

  • Add @sentry/node to both backend and auth Express apps for server-side error capture and performance tracing
  • Add X-Request-Id middleware for cross-service correlation with dj-site PostHog errors
  • Externalize @sentry/node in tsup configs so Sentry's monkey-patching works correctly
  • Pass SENTRY_RELEASE to Docker containers for release tracking

Closes #205

Test plan

  • npm run test:unit passes -- 125 tests (including 5 new requestId middleware tests)
  • npm run build succeeds for both workspaces
  • Deploy to EC2 with SENTRY_DSN set
  • Hit /healthcheck -- confirm X-Request-Id response header present
  • Trigger an error -- confirm it appears in Sentry with request_id tag and Express spans
  • From dj-site, send an API request -- confirm X-Request-Id correlates between PostHog and Sentry

…auth

Integrate @sentry/node for server-side error capture and performance
monitoring on both Express apps. Add X-Request-Id middleware for
cross-service correlation with dj-site PostHog errors.

- Sentry.init() in instrument.ts (imported first to patch modules)
- setupExpressErrorHandler() before existing error handlers
- X-Request-Id middleware: reads from request or generates UUID, tags Sentry scope
- CORS updated to allow/expose X-Request-Id header
- tsup configs externalize @sentry/node (monkey-patching requires unbundled)
- Deploy action passes SENTRY_RELEASE to container
- Auth service gets a fallback error handler (had none previously)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Sentry error tracking and performance tracing

1 participant