Airbrake’s New Ruby Notifier

We are excited to announce the new major release of our Ruby notifier library for Airbrake Bug Tracker!

airbrake-arthur

Fig. 1 — Arthur, our mascot flying the Ruby flag

It was as clear as day that the gem needed a major update. The code was hard to maintain, the issue tracker had too many unresolved issues, and some important pull requests couldn’t be easily merged because they diverged from the master branch. While these problems could be fixed in a minor release, we also wanted to improve our library API, simplify the configuration process, and add missing integrations.

Meet the new notifier

The new Airbrake gem (v5) is a complete rewrite from scratch. Moreover, it consists of two parts! We have split the library into airbrake and airbrake-ruby.

new-airbrake

Fig. 2 — The new Airbrake library consists of two gems

This was not an easy decision, but we’re happy with the outcome. The airbrake gem reports exceptions for Rails and other third-party Ruby libraries and frameworks, while the airbrake-ruby gem performs all the heavy-lifting like sending, filtering and truncating exceptions. This allowed us to design a clearer API and simplify testing. If you are using any frameworks or libraries like Rails or Sidekiq, it’s better to use airbrake (which depends on airbrake-ruby). For pure Ruby projects all you need is airbrake-ruby.

We have created airbrake-ruby to have zero dependencies, so gem install airbrake and require ‘airbrake’ are faster than ever. As for sending exceptions asynchronously, we’ve implemented our own solution independent of any third-party libraries, which even supports multiple workers. We also started benchmarking the gem’s code (Figure 3). This helped us write faster code, so the overhead of including the library in your application is as minimal as possible.

Fig. 3 — Benchmarking async notify with multiple workers (source code)

One of the hottest new features is the support for multiple notifiers in the same application/process. This is beneficial for users who want to send exceptions from different subsystems of the same application to multiple Airbrake projects (Figure 4). You are no longer limited to only one Airbrake.configure per application. Instead, you can configure as many notifiers as you want.

Fig. 4 — Configuring multiple notifiers

Other prominent changes include:

  • Improved JRuby support (we can send Java exceptions now)
  • Support for nested exceptions (a new dashboard is coming soon, which will show these nested exceptions hierarchically. For now they’ll display separately)
  • The Airbrake.add_filter API allows you to filter or attach data to your exceptions
  • Simplified configuration process (no more complex or obscure options)
  • Better Rails support (we now capture even more exceptions)
  • New integrations with ActiveJob and DelayedJob

Migrating to Airbrake V5

First of all, don’t worry, you don’t have to migrate immediately. The good news is that we still support Airbrake v4! We still accept pull requests with bug fixes, but it is feature-frozen.

Please use our migration guide to help you with the upgrade to v5. Also, bear in mind that we dropped support for ancient versions of Rubies and Rails so we can focus on ensuring a great user experience for the most common versions. Figure 3 shows officially supported Rubies and Rails.

Fig. 3 — Officially supported versions

Fig. 5 — Officially supported versions

Our YARD API documentation and README extensively describes the new library, so migration should be like a snap. The wiki is deprecated and should be used only if you still work with Airbrake v4. Email support@airbrake.io if you have any trouble upgrading.

Roadmap

While we’re happy about the progress made on the airbrake gem, it’s by no means the final version. We plan to update the error dashboard to properly display nested exceptions. There’s also a great demand for exceptions with attached snippets of code at each backtrace frame. This is a top priority on our airbrake gem roadmap.

Try it out

We encourage you to try out the new library. Sign up to start capturing exceptions in your Ruby apps now! Get in touch if you have any questions, problems, feature ideas, or bug reports, we look forward to hearing from you!

New to Airbrake? Start your 30-day free trial today and you’ll be organizing and tracking all your application’s errors in just a few minutes.