Skip to main content

Pulse

Pulse is an Application Performance Monitoring (APM) service that helps you understand and optimize your Rails application’s performance.

Features

Request Tracing

Trace requests across your entire stack with distributed tracing

Performance Metrics

Track response times, throughput, and error rates

Database Insights

Identify slow queries and N+1 problems

Auto-Instrumentation

13 libraries automatically instrumented

Quick Start

Add the gem and configure:
Gemfile
gem 'brainzlab'
config/initializers/brainzlab.rb
BrainzLab.configure do |config|
  config.secret_key = ENV['BRAINZLAB_SECRET_KEY']
  config.pulse_enabled = true
end
That’s it! Pulse automatically instruments your application.

Automatic Instrumentation

Pulse automatically tracks these libraries:
LibraryWhat’s Tracked
Rails/RackRequests, responses, timing breakdown
Active RecordSQL queries with duration
Net::HTTPOutbound HTTP calls
FaradayHTTP client requests
HTTPartyHTTP client requests
RedisCommands and duration
SidekiqJobs, queue wait time, distributed tracing
Delayed::JobJob execution
GraphQLQuery and field resolution
GrapeAPI endpoints
MongoDBDatabase operations
ElasticsearchSearch operations
ActionMailerEmail delivery time

Instrumentation Details

See detailed documentation for each instrumented library

Performance Insights

Latency Percentiles

Track P50, P95, and P99 latencies to understand your performance distribution:
  • P50 - Median response time (50% of requests faster)
  • P95 - 95th percentile (only 5% slower)
  • P99 - 99th percentile (catches outliers)

Throughput

Monitor requests per minute over time to:
  • Spot traffic patterns
  • Identify peak hours
  • Plan capacity

Error Rate

Track error percentage across:
  • All endpoints
  • Individual routes
  • Background jobs

Distributed Tracing

Pulse supports distributed tracing across services:
Web Request (trace-123)
├── Rails Controller (50ms)
│   ├── SQL: SELECT users (5ms)
│   └── HTTP: api.stripe.com (30ms)
└── Sidekiq Job (linked via trace-123)
    ├── SQL: UPDATE orders (3ms)
    └── Redis: SET order:123 (1ms)
Supported propagation formats:
  • W3C Trace Context (traceparent header)
  • B3 (X-B3-TraceId, X-B3-SpanId headers)

Custom Spans

Add custom spans for business logic:
BrainzLab::Pulse.trace("calculate_shipping", kind: "business") do |span|
  span[:data] = {
    weight: package.weight,
    destination: address.country
  }

  ShippingCalculator.calculate(package, address)
end

Dashboard

View your performance data in the Pulse dashboard:
  • Overview - Apdex score, latency, throughput, errors
  • Endpoints - Performance by route
  • Traces - Individual request waterfalls
  • Database - Slow queries, N+1 detection

View Dashboard

Open the Pulse dashboard

Configuration

BrainzLab.configure do |config|
  # Enable/disable Pulse
  config.pulse_enabled = true

  # Sample rate (1.0 = 100%)
  config.pulse_sample_rate = 1.0

  # Exclude paths
  config.pulse_excluded_paths = ['/health', '/ping', '/assets']

  # Disable specific instrumentations
  config.instrument_redis = false
  config.instrument_sidekiq = false
end

What’s Next?