Skip to main content
Performance monitoring helps identify slow operations and optimize user experience while minimizing overhead on your application.

Enabling Performance Monitoring

Browser Applications

Node.js Applications

For Node.js SDK v8+, you MUST initialize Sentry before any other imports for OpenTelemetry instrumentation to work.

Instrumentation

Automatic Instrumentation

The SDK automatically instruments: Browser:
  • Page load transactions
  • Navigation transactions
  • Fetch/XHR requests
  • User interactions (clicks, form inputs)
  • Web Vitals (LCP, FID, CLS, INP, TTFB)
Node.js:
  • HTTP/HTTPS requests
  • Express.js routes
  • Database queries (Prisma, MongoDB, MySQL, PostgreSQL)
  • GraphQL operations
  • Redis operations

Manual Instrumentation

Create custom spans for specific operations:

Nested Spans

Track sub-operations:

Controlling Span Creation

HTTP Instrumentation

Control which requests create spans:

Browser Request Instrumentation

Trace Propagation

Control distributed tracing headers:
In v8+, trace propagation defaults to same-origin requests. Only set tracePropagationTargets for cross-origin distributed tracing.

Web Vitals

Monitor Core Web Vitals automatically:

Custom Measurements

Add custom performance measurements:

Transaction Naming

Browser Route Naming

Custom Transaction Names

Node.js Route Naming

Sampling Strategies

Prioritize Important Transactions

Environment-Based Sampling

Performance Overhead Reduction

Disable Unnecessary Integrations

Limit Breadcrumb Collection

Selective Instrumentation

Framework-Specific Optimizations

React

Next.js

Next.js SDK handles instrumentation automatically:

Vue

Database Query Instrumentation

Prisma

MongoDB (Mongoose)

Best Practices

High-traffic applications should use lower sample rates:
These create noise without value:
Set appropriate op values for better organization:
Too many spans can increase overhead. Focus on meaningful operations:
Add context to help debug performance issues:

Monitoring Performance Impact

Check SDK Overhead

Profile Mode

Enable profiling for deeper insights:

Complete Example

Next Steps

Bundle Size Optimization

Reduce SDK bundle size impact

Source Maps

Configure source maps for production