Installation
Basic Setup
Create an instrumentation file and import it before any other code:--import flag:
Express Integration
Automatic instrumentation for Express.js:Framework Integrations
- Fastify
- Koa
- Hapi
- Connect
Database Integrations
- Prisma
- MongoDB
- Mongoose
- PostgreSQL
- MySQL
- Redis
AI SDK Integrations
- OpenAI
- Anthropic
- Google GenAI
- LangChain
- LangGraph
Performance Monitoring
Automatic Instrumentation
The SDK automatically instruments:- HTTP/HTTPS requests
- Express/Fastify/Koa routes
- Database queries
- File system operations
- Child processes
Custom Spans
Nested Spans
Error Handling
Automatic Capture
Manual Capture
Context & Scope
User Context
Request Isolation
Profiling
Enable CPU profiling:Cron Monitoring
Monitor scheduled jobs:Local Variables
Capture local variables in stack traces:Context Lines
Capture source code context:Best Practices
Import First
Always import the instrumentation file before any other code.
Use Integrations
Enable framework-specific integrations for automatic instrumentation.
Request Isolation
Use isolation scopes to separate context between requests.
Sampling
Adjust sample rates in production to control costs.
Configuration
Complete Configuration
Complete Configuration
Next Steps
Express
Express.js integration guide
Prisma
Prisma integration guide
OpenTelemetry
OpenTelemetry setup
Profiling
CPU profiling guide