Flux
Flux is a custom metrics and events platform that lets you track anything and see everything in your Rails application.Features
Custom Events
Track any discrete occurrence in your application
Metrics
Gauges, counters, distributions, and sets
Dashboards
Build custom dashboards with widgets
Anomaly Detection
AI-powered detection of spikes, drops, and trends
Quick Start
Add the gem and configure:Gemfile
config/initializers/brainzlab.rb
Event Tracking
Events are discrete occurrences with a name, timestamp, and optional properties:- Properties - Arbitrary key/value data
- Tags - Indexed metadata for filtering
- Value - Numeric value for aggregations
- User ID - Link events to users
Metrics
Track four types of metrics:| Type | Use Case | Example |
|---|---|---|
| Gauge | Current value | users.online, queue.depth |
| Counter | Incrementing | api.requests, emails.sent |
| Distribution | Stats (avg, p95) | response_time, order_value |
| Set | Unique counts | daily_active_users |
Timing Operations
Measure code execution time automatically:Dashboards
Create custom dashboards with widgets:- Number - Single metric value
- Graph - Time series charts
- Bar - Categorical comparisons
- Pie - Distribution breakdown
- Table - Tabular data
- Heatmap - Time-based patterns
Dashboard Guide
Learn how to build dashboards
Anomaly Detection
Flux automatically detects unusual patterns:- Spikes - Values more than 3x baseline
- Drops - Values below 30% of baseline
- Trends - Sustained directional changes
- Info - 0-50% deviation
- Warning - 50-100% deviation
- Critical - Over 100% deviation
Anomaly Detection
Configure anomaly detection