Pulse - APM & Distributed Tracing
Pulse automatically instruments your Rails application to track performance and provide distributed tracing.Automatic Instrumentation
Pulse automatically instruments these libraries when detected:| Library | What’s Tracked |
|---|---|
| Rails/Rack | Request duration, status, breakdown |
| Active Record | SQL queries, duration, query count |
| Net::HTTP | Outbound HTTP requests |
| Faraday | HTTP client requests |
| HTTParty | HTTP client requests |
| Redis | Redis commands |
| Sidekiq | Job processing, queue wait time |
| Delayed::Job | Job processing |
| GraphQL | Query execution, field resolution |
| Grape | API endpoint performance |
| MongoDB | Database operations |
| Elasticsearch | Search operations |
| ActionMailer | Email delivery time |
Configuration
config/initializers/brainzlab.rb
Controlling Instrumentation
Enable or disable specific instrumentations:Distributed Tracing
Pulse automatically propagates trace context across services using W3C Trace Context and B3 headers.Extracting Context (Incoming)
Context is automatically extracted from incoming requests in Rails. For custom extraction:Injecting Context (Outgoing)
Context is automatically injected into outgoing HTTP requests. For custom injection:Custom Spans
Add custom spans for operations you want to track:Nested Spans
Sidekiq Integration
Sidekiq jobs are automatically traced with:- Job execution time
- Queue wait time (time spent in queue)
- Error tracking
- Distributed trace context propagation
GraphQL Integration
For GraphQL-Ruby 2.0+, add the tracer to your schema:- Query execution time
- Individual field resolution (fields taking >10ms)
- Query complexity
Grape API Integration
For Grape APIs, use the middleware:Viewing Traces
View traces in the Pulse dashboard:- Request waterfall view
- Span breakdown by type
- Slow query detection
- Error correlation
Sampling
For high-traffic applications, use sampling:Environment Variables
| Variable | Description |
|---|---|
PULSE_URL | Custom Pulse endpoint (self-hosting) |
BRAINZLAB_DEBUG | Enable debug logging |