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:Transactions
Transactions represent a single instance of a service being called. UsestartSpan 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 status1-OK: Success2-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:Getting Active Span
Access the currently active span:Integration Examples
React Component
Express.js Route
Best Practices
- Use descriptive names: Name transactions and spans clearly to understand what they measure
- Set appropriate operations: Use standard operation names for consistency
- Add relevant attributes: Include data that helps identify slow operations
- Sample wisely: Balance data volume with coverage needs
- Measure meaningful operations: Focus on user-facing and critical operations
- 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
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