NestJS · Senior · Question 33 of 75
How do you add distributed tracing to a Nest app?
- 1Add
console.timeto every controller - 2Nest traces automatically without setup
- ✓Correct answer: Initialize OpenTelemetry before Nest loads (a separate
tracing.tsimported first), with instrumentations for HTTP, Express/Fastify, Nest and DB clients
Explanation
Instrumentation must patch modules before they're required, which is why it runs first.