Next.js · Senior · Question 19 of 75
What is the instrumentation.ts file with a register() function for?
- ✓Correct answer: Running code once on server startup, e.g. to set up OpenTelemetry
- 2Adding a global click handler to all pages for analytics
- 3Describing the module build and loading order for Turbopack
Explanation
register is called when a new server instance starts - suitable for initializing tracing, monitoring and logging. onRequestError lets you send server errors to a monitoring system. For the client side there's instrumentation-client.ts.