Installation
Version Compatibility
- Angular 14+ is fully supported
- Angular 10-13: Use SDK version 7.x
- Angular versions below 10: Not supported
Basic Setup
- Standalone (Angular 14+)
- NgModule (Legacy)
Initialize Sentry before bootstrapping your application:
ErrorHandler Integration
Register Sentry’s ErrorHandler to capture Angular errors:- Standalone (Angular 14+)
- NgModule (Legacy)
Performance Monitoring
TraceService Setup
Enable automatic route change tracking:- Angular 19+ (provideAppInitializer)
- Angular 14-18 (APP_INITIALIZER)
- NgModule (Legacy)
Initialize Browser Tracing
Component Tracking
Track component performance with decorators and directives:- TraceDirective
- TraceClass Decorator
- TraceMethod Decorator
Track component initialization in templates:This tracks the duration between
OnInit and AfterViewInit lifecycle hooks.Custom Performance Tracking
Track Bootstrap Process
Track Service Methods
Error Handling
Manual Error Capture
ErrorHandler Options
HTTP Interceptor
Track HTTP requests:Context & User Information
Router Instrumentation
The SDK automatically instruments Angular Router when TraceService is initialized:Advanced Configuration
Complete Angular Setup
Complete Angular Setup
Best Practices
TraceService
Always inject TraceService to enable automatic route tracking.
ErrorHandler
Register the ErrorHandler provider to catch all Angular errors.
Component Tracking
Use TraceDirective for template-based tracking, decorators for classes.
Lazy Loading
Component tracking works with lazy-loaded modules automatically.
Next Steps
Router Tracking
Advanced router instrumentation
HTTP Interceptor
Track HTTP requests and responses
Performance
Component performance monitoring
Source Maps
Upload source maps for production