Hello, Rails engineers! Today, I’d like to recommend Honeybadger as an error-tracking tool for small development teams working on Rails projects. Honeybadger offers ease of use and a powerful feature set that can significantly improve your development efficiency.
Why Choose Honeybadger?
- Simple Setup: Easy integration into Rails projects.
- Real-Time Alerts: Instantly notify you of critical errors.
- Detailed Error Information: Provides rich data like stack traces, environment variables, and parameters.
- Performance Monitoring: Track application performance alongside error tracking.
- Uptime Monitoring: Keep an eye on your app’s availability.
- Cron Job Monitoring: Ensure cron jobs are running smoothly.
Setup Instructions
- Add this to your Gemfile:
gem 'honeybadger', '~> 5.0'
- Run the bundle install command:
bundle install
- Execute the Honeybadger setup script:
bundle exec honeybadger install HONEYBADGER_API_KEY
That’s all you need for basic setup!
Effective Usage
Custom Error Notifications
You can set up custom notifications for specific conditions:
begin
# Some processing
rescue => e
Honeybadger.notify(
error_class: "CustomError",
error_message: "A critical error occurred",
context: {
user_id: current_user.id,
action: "important_action"
}
)
end
Adding Context
Adding user or request data makes it easier to identify error causes:
class ApplicationController < ActionController::Base
before_action :set_honeybadger_context
private
def set_honeybadger_context
Honeybadger.context(
user_id: current_user.id,
user_email: current_user.email,
plan: current_user.plan
)
end
end
Real-Time Alerts
You can configure notifications to send alerts via email, Slack, or other tools. Honeybadger integrates well with platforms like GitHub, automatically creating issues for errors. Once you fix the error and deploy the change, Honeybadger will automatically mark the issue as resolved.
Performance Monitoring
A notable feature is Insights.
insights:
enabled: true
By enabling this, you can monitor performance data and query it using BadgerQL, similar to a log management tool like Papertrail. However, log data fees can be high, so be mindful of this.
events:
ignore:
- event_type: 'sql.active_record'
Since SQL logs can quickly consume space, disabling them can effectively save on log data costs.
Using this information, you can create an APM-like dashboard to monitor performance trends.
Uptime Monitoring
Though a small feature, Honeybadger includes uptime monitoring. Our team migrated from Pingdom to Honeybadger's Uptime feature, simplifying our monitoring stack and reducing costs.
Cron Job Monitoring
We previously used Dead Man’s Snitch for cron job monitoring, but Honeybadger’s Check-Ins feature looks promising, and we’re considering migrating to it.
Deployment Tracking
By running this command during deployment, you can track deployments:
honeybadger deploy --environment=production --revision=$(git rev-parse HEAD) --repository=git@github.com:your/repo.git
Summary
Honeybadger is an excellent tool for small Rails teams. Its simple setup, rich monitoring features, and ease of use significantly improve development workflows. It helps detect and resolve errors early, contributing to application stability.
Our team previously used the open-source error tracker Errbit, which worked well for catching errors and sending notifications. However, we switched to Honeybadger when Errbit's Ruby version became outdated. While we still contribute to Errbit, Honeybadger provides more stable application operations, leading to our decision to adopt it.
Top comments (0)