The Raygun4Ruby provider

This is the official provider for the Ruby ecosystem - it also has built-in support for Rails.

Why add Raygun to my Ruby app?

Ruby is a great, flexible language that allows you to write powerful applications, whether for the web with a framework or elsewhere. All software has bugs; a good developer recognizes this and the fact that the correct tools can help minimize their effect. Specifically, the effect on his or her users. Raygun lets your app automatically send all errors and exceptions that it generates, and places them on a dashboard, allowing you to easily diagnose and fix the issue.

Raygun4Ruby Features

This provider has first-class support for:

  1. Ruby 1.9 or greater
  2. Rails 3/4

It also includes a Resque failure backend, for notifying Raygun if its queue falls over.

Installation

It comes as a gem, so add this line to your application's Gemfile':

gem 'raygun4ruby'

And then execute:

bundle

Or install it yourself using:

gem install raygun4ruby

Then execute:

rails g raygun:install your_api_key

You can then test the integration by running:

rake raygun:test

You will then see an ItWorksException in your Raygun dashboard.

Manual exception tracking

With vanilla Ruby, it's easy as:

require 'rubygems'
require 'raygun4ruby'

Raygun.setup do |config|
  config.api_key = "YOUR_RAYGUN_API_KEY"
  config.filter_parameters = [ :password, :card_number, :cvv ] # don't forget to filter out sensitive parameters
  config.enable_reporting = true # to send errors, false to not log
end

begin
  # your lovely code here
rescue Exception => e
  Raygun.track_exception(e)
end

More information

Visit the GitHub repository to view the source code, or post a question in the Raygun forums.