Error tracking with instant reaction for Rails apps.
# Install SDK
gem 'brainzlab'
# Configure
BrainzLab.configure { |c| c.reflex_key = ENV['REFLEX_API_KEY'] }
# Capture errors (automatic with middleware)
BrainzLab::Reflex.capture(exception, user: current_user)docker pull brainzllc/reflex:latest
# or
docker pull ghcr.io/brainz-lab/reflex:latest
docker run -d \
-p 3000:3000 \
-e DATABASE_URL=postgres://user:pass@host:5432/reflex \
-e REDIS_URL=redis://host:6379/2 \
-e RAILS_MASTER_KEY=your-master-key \
brainzllc/reflex:latest# Gemfile
gem 'brainzlab'# config/initializers/brainzlab.rb
BrainzLab.configure do |config|
config.reflex_key = ENV['REFLEX_API_KEY']
endgit clone https://github.com/brainz-lab/reflex.git
cd reflex
bundle install
bin/rails db:create db:migrate db:seed
bin/rails server| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
PostgreSQL connection | Yes |
REDIS_URL |
Redis connection | Yes |
RAILS_MASTER_KEY |
Rails credentials | Yes |
BRAINZLAB_PLATFORM_URL |
Platform URL for auth | Yes |
SERVICE_KEY |
Internal service key | Yes |
SLACK_WEBHOOK_URL |
Slack notifications | No |
- Ruby 3.4.7 / Rails 8.1
- PostgreSQL 16 with JSONB
- Redis 7
- Hotwire (Turbo + Stimulus) / Tailwind CSS
- Solid Queue / Solid Cache / Solid Cable
# Automatic capture with middleware (Rails)
# Errors are automatically captured!
# Manual capture
begin
risky_operation
rescue => e
BrainzLab::Reflex.capture(e, user: current_user, context: { order_id: order.id })
end
# With extra context
BrainzLab::Reflex.set_context(user: current_user)
BrainzLab::Reflex.set_tags(environment: "production", region: "us-east-1")Errors are grouped by fingerprint generated from:
- Error class -
NoMethodError,ActiveRecord::RecordNotFound - File path - First frame's file location
- Function name - Method where error occurred
- Normalized message - IDs and numbers replaced with placeholders
| Status | Description |
|---|---|
unresolved |
New or recurring error |
resolved |
Fixed, will reopen if it recurs |
ignored |
Won't trigger alerts |
muted |
Temporarily silenced |
{
"error_class": "NoMethodError",
"message": "undefined method `foo' for nil:NilClass",
"backtrace": [
"app/models/user.rb:42:in `save'",
"app/controllers/users_controller.rb:23:in `create'"
],
"environment": "production",
"commit": "abc123",
"timestamp": "2024-12-21T10:00:00Z",
"request": {
"method": "POST",
"path": "/users",
"params": {"name": "John"},
"headers": {"User-Agent": "..."}
},
"user": {
"id": "user_123",
"email": "john@example.com"
},
"context": {
"order_id": "order_456"
},
"tags": {
"region": "us-east-1"
}
}POST /api/v1/errors- Report single errorPOST /api/v1/errors/batch- Batch report
GET /api/v1/errors- List error groupsGET /api/v1/errors/:id- Get error details with events
POST /api/v1/errors/:id/resolve- Mark resolvedPOST /api/v1/errors/:id/ignore- Ignore errorPOST /api/v1/errors/:id/unresolve- Reopen errorPOST /api/v1/errors/:id/mute- Mute temporarily
| Tool | Description |
|---|---|
reflex_list |
List errors (filter by status, sort) |
reflex_show |
Get error details + backtrace |
reflex_resolve |
Mark error as resolved |
reflex_ignore |
Ignore an error |
reflex_unresolve |
Reopen a resolved error |
reflex_stats |
Error statistics and trends |
reflex_search |
Search by class, user, commit |
Full documentation: docs.brainzlab.ai/products/reflex
services:
reflex:
image: brainzllc/reflex:latest
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://user:pass@db:5432/reflex
REDIS_URL: redis://redis:6379/2
RAILS_MASTER_KEY: ${RAILS_MASTER_KEY}
BRAINZLAB_PLATFORM_URL: http://platform:3000
depends_on:
- db
- redisbin/rails test # Unit tests
bin/rails test:system # System tests
bin/rubocop # LintingSee CONTRIBUTING.md for development setup and contribution guidelines.
- brainzlab-ruby - Ruby SDK
- Recall - Structured logging
- Pulse - APM
- Stack - Self-hosted deployment
MIT