← All platforms

Rails error tracking

A request at noon. A job at midnight. The Sentry Rails integration sends their errors to Telebugs on your own server.

~/hoofnotes  bundle add sentry-ruby sentry-rails
Bundle complete!
~/hoofnotes  nvim config/initializers/sentry.rb
Sentry.init do |config|
# Copy the complete Telebugs DSN, key and path included.
config.dsn = "YOUR_TELEBUGS_DSN"
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
end
~/hoofnotes  bin/rails runner 'Sentry.capture_exception(StandardError.new("Hello from Hoof Notes"))'

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep the gems and your initializer. Change the DSN to Telebugs and restart your web and worker processes. There’s no new error-reporting API or Sentry account to deal with.

Do I need to rescue every exception?

No. sentry-rails reports unhandled request errors. If you rescue an exception and still want a report, Sentry.capture_exception does that.

What about background jobs?

The Rails integration covers unhandled Active Job exceptions. Sidekiq has its own SDK integration, too. A failed job can leave you a report even when nobody is looking at a web page.

What will I see in the report?

The exception, its Ruby backtrace, and the context the SDK sends, including any enabled breadcrumbs. Telebugs also has sensitive-data scrubbing for details you don’t want in a report.