Honey badgers are pretty badass. Honeybadger.io is not badass at all, but it tracks errors and monitors web applications with ease.
Installing it for a production Rails app is super simple. Just do what they tell you after signing up. This will install the gem and generate a config/honeybadger.rb
that sets your API key among other options. I prefer to remove the hard-coded API key here and replace it with a Rails credential called honeybadger_api_key
that was added via rails credentials:edit
.
api_key: "<%= Rails.application.credentials.honeybadger_api_key %>"
Just deploy the updated Gemfile
, Gemfile.lock
, config/honeybadger.rb
, and config/credentials.yml.enc
and that's all there is to do to get Honeybadger live.
A useful little feature of Honeybadger are so-called "check-ins", intended to monitor cronjobs and the like. For example, if you have a regularly scheduled background job, a check-in will tell Honeybadger, that the job has indeed run. If a check-in does not occur within a given time frame and grace period, something must be up and Honeybadger will alert you.
Using the official Honeybadger Ruby gem, it is very easy to trigger check-ins. When creating a new check-in in the Honeybadger web app, you receive an ID which can then be passed to a .check_in
class method:
Honeybadger.check_in('1MqIo1')`
For this website, I'm using the rufus-scheduler1 to perform various background jobs. At the end of each job, a check-in is triggered:
scheduler.cron '0 */2 * * *' do
# do stuff
# ...
Honeybadger.check_in('1MqIo1')
end
The free "Basic" plan allows you to create five check-ins.