Rails Integration
The Brainz Lab SDK provides deep integration with Rails.Automatic Features
When you install the SDK in a Rails app, you automatically get:Request Context
Every log includes request information:Error Capture
Unhandled exceptions are automatically reported to Reflex with zero configuration:- Rails 7+ ErrorReporter - Subscribes to
Rails.error.subscribe - Controller rescue_from - Captures controller exceptions
- ActiveJob errors - Captures background job failures
- Sidekiq errors - Captures Sidekiq job failures (if Sidekiq is present)
User Tracking
Set the current user and it’s included everywhere:ActiveRecord Integration
Query Logging
SQL queries are captured as breadcrumbs:Slow Query Alerts
Log slow queries:ActiveJob Integration
Background jobs are automatically instrumented:Error Tracking in Jobs
Job errors are captured with full context:Sidekiq Integration
Sidekiq is automatically detected and configured. No additional setup required:- Job class name
- Job ID (jid)
- Queue name
- Job arguments (first 5, for safety)
- Retry count
Action Cable Integration
WebSocket events are tracked:Rails Logger Replacement
Send all Rails logs to Recall with a single line:View Instrumentation
Track view rendering:Middleware
The SDK adds middleware automatically:- BrainzLab::Rails::Middleware - Captures request context, breadcrumbs, and clears context after request
- Request ID
- Session ID (if loaded)
- Request method, path, URL
- Filtered request parameters
- Request headers (excluding Cookie and Authorization)
Zero-Configuration Error Tracking
The SDK provides “nothing to do” error tracking. Just install the gem and configure your API key:| Source | What’s Captured |
|---|---|
| Controllers | All unhandled exceptions with request context |
| ActiveJob | Job failures with job class, ID, queue, arguments |
| Sidekiq | Job failures with retry count and job metadata |
| Rails.error | All errors reported via Rails 7+ error reporter |
Disable Automatic Capture
To disable automatic capture in specific environments:Pulse APM Integration
Pulse provides automatic performance monitoring for Rails applications.Request Tracing
Every request is automatically traced with detailed timing breakdown:Automatic Instrumentation
Pulse automatically instruments these Rails components:| Component | What’s Tracked |
|---|---|
| Rack/Rails | Request method, path, status, timing |
| Active Record | SQL queries with duration |
| ActionView | Template and partial rendering |
| ActionMailer | Email delivery time |
| ActiveJob | Job execution time |
| Net::HTTP | Outbound HTTP requests |