Skip to main content
Performance monitoring helps you track the speed and reliability of your application. Sentry captures performance data through transactions and spans, giving you insights into what’s slow and why.

Getting Started

Enable performance monitoring during SDK initialization:
In production, adjust tracesSampleRate to a lower value (e.g., 0.1 for 10%) to reduce data volume and costs.

Sampling

Uniform Sample Rate

Set a fixed sample rate for all transactions:

Dynamic Sampling

Use a function to dynamically sample transactions:
Use tracesSampler for fine-grained control over which transactions to sample based on their context.

Transactions

Transactions represent a single instance of a service being called. Use startSpan to create transactions:

Transaction Operations

Use standard operation names for consistency:

Async Operations

Transactions work seamlessly with async code:

Measuring Operations

Basic Timing

Measure how long operations take:

Nested Operations

Create child spans for detailed timing:

Span Attributes

Add custom data to spans:
Span attributes are searchable and can be used for filtering and grouping in the Sentry UI.

Span Status

Set the status of a span to indicate success or failure:

Status Codes

  • 0 - UNSET: Default status
  • 1 - OK: Success
  • 2 - ERROR: Error occurred

HTTP Status Codes

Automatically set span status from HTTP responses:

Custom Measurements

Add custom measurements to spans:

Suppressing Tracing

Temporarily disable tracing for specific operations:
Use suppressTracing sparingly and only when you need to prevent instrumentation of internal operations that would create noise.

Getting Active Span

Access the currently active span:

Integration Examples

React Component

Express.js Route

Best Practices

  1. Use descriptive names: Name transactions and spans clearly to understand what they measure
  2. Set appropriate operations: Use standard operation names for consistency
  3. Add relevant attributes: Include data that helps identify slow operations
  4. Sample wisely: Balance data volume with coverage needs
  5. Measure meaningful operations: Focus on user-facing and critical operations
  6. Keep spans focused: Each span should represent a single logical operation

Performance Impact

Sentry’s performance monitoring is designed to have minimal impact:
  • Lightweight instrumentation
  • Efficient sampling
  • Async processing
  • No blocking operations
Start with a higher sample rate in development and lower it in production based on your traffic and needs.

Next Steps

Tracing

Learn about distributed tracing

Spans

Deep dive into spans and instrumentation

Distributed Tracing

Track requests across services

Session Replay

Combine performance data with session replay