🌟 Extraordinary insight into your users and background jobs
Wouldn’t it be great to see when one of your users encounters an error, timeout, or validation failure? Now you can - directly in your admin pages.
Notable tracks notable requests and background jobs and stores them in your database. What makes a request or job notable? There are a number of default situations, but ultimately you decide what interests you.
By default, Notable tracks:
- errors
- 404s
- slow requests and jobs
- timeouts
- validation failures
- CSRF failures
- unpermitted parameters
- blocked and throttled requests
You can track custom notes as well.
🍊 Battle-tested at Instacart
Add this line to your application’s Gemfile:
gem 'notable'
And run:
rails generate notable:requests
rails generate notable:jobs
rails db:migrate
To explore the data, check out Blazer.
A Notable::Request
is created for:
- errors
- 404s
- slow requests
- timeouts
- validation failures
- CSRF failures
- unpermitted parameters
- blocked and throttled requests
For timeouts, use Slowpoke.
For blocked and throttled requests, use Rack Attack.
Wouldn’t it be great to have a record of exact jobs that fail?
A Notable::Job
is created for:
- errors
- slow jobs
- validation failures
Notable.track(note_type, note)
Like
Notable.track("Auth Event", "Signed In")
Disable tracking in certain environments
Notable.enabled = Rails.env.production?
Set slow threshold
Notable.slow_request_threshold = 5.seconds
Custom user method
Notable.user_method = lambda do |env|
env["warden"].try(:user) || env["action_controller.instance"].try(:current_visit)
end
Custom track method
Notable.track_request_method = lambda do |data, env|
Notable::Request.create!(data)
end
Skip tracking CSRF failures
skip_before_action :track_unverified_request
Anonymize IP addresses
Notable.mask_ips = true
Set slow threshold
Notable.slow_job_threshold = 60.seconds
To set a threshold for a specific job, use:
class CustomJob < ApplicationJob
def notable_slow_job_threshold
5.minutes
end
end
Custom track method
Notable.track_job_method = lambda do |data|
Notable::Job.create!(data)
end
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/notable.git
cd notable
bundle install