What you instrument
- Errors — Sentry / Datadog / Bugsnag for thrown exceptions in Server Components, Server Actions, and Client Components alike.
- Performance — Web Vitals (LCP, CLS, INP) per page; Vercel Speed Insights or your own reporter.
- Logs — structured logs from
consolecalls; pipe them into your log aggregator.
The instrumentation file
instrumentation.ts at the root runs once when the server starts. Use it to initialize Sentry / OpenTelemetry / any monitoring SDK once at boot. Stable since Next.js 15.
Instrument outcomes before incidents: structured logs with request and release IDs, traces across external calls, error reports with source maps, and Web Vitals by route and device. Define alert ownership and a small set of symptoms tied to user impact. Collecting everything is not observability. High-cardinality fields, personal data, noisy alerts, and unbounded retention increase cost while hiding the signal. A dashboard no one owns is decoration.
Trigger a controlled server error, client error, slow dependency, and degraded interaction in a preview deployment. Follow each signal from the user's route to the release and trace, verify redaction, and confirm the alert reaches an owner with a useful runbook.