Flux - Custom Events & Metrics
Flux lets you track custom events and metrics in your Rails application, with support for dashboards and anomaly detection.Configuration
config/initializers/brainzlab.rb
Events
Track discrete occurrences in your application.Basic Event
Event with Properties
Event with Tags
Tags are indexed for fast filtering:Event with Value
Values enable aggregations:Full Event
Metrics
Track numeric values over time with four metric types.Gauge
Current value that can go up or down:Counter
Incrementing values:Distribution
Statistical values (avg, p95, etc.):Set
Unique counts:Timing Operations
Automatically measure execution time:Batching
The SDK automatically batches for performance. Manual control:Rails Integration
Controller Events
Model Callbacks
Background Jobs
Periodic Gauges
Use Cases
Funnel Tracking
Feature Usage
Business Events
Testing
Disable Flux in tests:Environment Variables
| Variable | Description |
|---|---|
FLUX_URL | Custom Flux endpoint (self-hosting) |
FLUX_BATCH_SIZE | Override batch size |
FLUX_FLUSH_INTERVAL | Override flush interval |
BRAINZLAB_DEBUG | Enable debug logging |