IntegrateMonitoring
Sentry integration
Capture errors and traces with Sentry
For error monitoring across Athena, Hera, and Site, integrate Sentry.
Setup
Each app installs the Sentry SDK:
cd athena && bun add @sentry/nextjs
cd ../hera && bun add @sentry/nextjs
cd ../site && bun add @sentry/nextjsPer app, create sentry.client.config.ts:
import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: process.env.NODE_ENV,
release: process.env.APP_VERSION,
tracesSampleRate: 0.1,
});And sentry.server.config.ts similarly.
Identifying users (privacy)
Sentry can identify users from errors:
Sentry.setUser({
id: session.identity_id,
// Don't send: email, IP, these are PII.
});For HIPAA / strict GDPR, set sendDefaultPii: false globally.
What to capture
- Errors: automatic.
- Performance traces: 10% sample rate typical; tune per traffic.
- Auth flow failures: emit Sentry events from your custom flow handlers.
What NOT to send
- OAuth2 tokens, Sentry breadcrumbs may include URLs with
code=orid_token_hint=. Configure URL sanitization:Sentry.init({ beforeSend(event) { if (event.request?.url) { event.request.url = event.request.url.replace(/([?&])(code|id_token_hint|token)=[^&]+/g, "$1$2=[REDACTED]"); } return event; }, }); - Session cookies, strip from headers.
- Identity emails / names in error messages.
Per-domain DSNs
Use separate Sentry projects for:
- Athena CIAM, Athena IAM (admin tools).
- Hera CIAM, Hera IAM (user-facing).
- Site (brochure + playground + docs).
Lets you triage independently.
Source maps
For useful stack traces, upload source maps from CI:
# In your deploy workflow
- name: Upload source maps to Sentry
run: npx @sentry/cli releases files $APP_VERSION upload-sourcemaps .nextAlerts
Set Sentry alerts for:
- New error rate spike (Athena).
- Auth flow exceptions (Hera).
- Performance regression (Site OAuth2 playground).
Cost
Free tier: 5k errors/month. Paid: $26/mo+ depending on volume.