Event Filtering with beforeSend
ThebeforeSend hook processes all error events before they’re sent:
Event Hint
Thehint parameter contains the original error and additional context:
Transaction Filtering with beforeSendSpan
Filter performance data before sending:Filtering with Integrations
Inbound Filters Integration
TheinboundFiltersIntegration (enabled by default) filters common noise:
Common Ignore Patterns
Breadcrumb Filtering
Filter breadcrumbs before they’re added:Filtering Sensitive Data
Scrubbing Request Data
Scrubbing User Data
Filtering by Error Type
Filtering by User
Filtering by Environment
Filtering Network Requests
HTTP Client Integration
Filter outgoing request breadcrumbs:Filtering Third-Party Errors
Use thethirdPartyErrorFilterIntegration to filter errors from third-party scripts:
Advanced Filtering Patterns
Rate Limiting Specific Errors
Conditional Filtering Based on Context
Best Practices
Use allowlists instead of denylists
Use allowlists instead of denylists
When possible, explicitly allow what you want rather than denying what you don’t:
Filter at the source
Filter at the source
It’s more efficient to prevent events from being created than to filter them in
beforeSend:Always return or drop
Always return or drop
In
beforeSend and beforeBreadcrumb, always explicitly return or drop:Don't filter too aggressively
Don't filter too aggressively
Overly aggressive filtering can hide important issues. Start conservative and refine based on actual noise.
Log filtered events in development
Log filtered events in development
In development, log what you’re filtering to verify your rules:
Complete Example
Next Steps
Error Handling
Best practices for error handling
Performance Monitoring
Optimize performance monitoring