Skip to content

Add Sentry error tracking and performance tracing#206

Merged
jakebromberg merged 1 commit intomainfrom
feat/sentry-tracing
Mar 10, 2026
Merged

Add Sentry error tracking and performance tracing#206
jakebromberg merged 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

Copy link
Collaborator

@AyBruno AyBruno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AyBruno AyBruno force-pushed the feat/sentry-tracing branch from be0707f to 3e76507 Compare March 9, 2026 00:17
…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)
@jakebromberg jakebromberg merged commit a98da50 into main Mar 10, 2026
4 checks passed
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

2 participants