hoptoad

A couple of Airbrake tips

| 0 Comments

No software is complete without bugs and no Rails application is complete without proper exception tracking. In most cases we choose Airbrake to collect those exceptions for us.

Here’s a couple of tips to make Airbrake more useful.

Server-specific environment names

Here at the Playhem team we have multiple independent staging servers for testing multiple features simultaneously. If all the staging servers use the same Rails environment, Airbrake’s exception logging becomes messed up, because it categorises errors by Rails environments; it isn’t always clear as to which server and feature is the exception related to.

We could use a separate Rails environment for each staging server, but since they are otherwise identical, there is a simpler solution. Airbrake has custom environment_name setting, which can be set manually to whatever you want. I chose to customize the environment name using server-specific configs and our wonderful multi-deploy tool, but you could also use the server name, or any environment variable.

The best practice is to use a unique Airbrake environment_name for each server to avoid any confusion as to where did the exception happen.

Another important benefit of using server-specific environment names is that the “mark exceptions as resolved upon deploy” setting doesn’t make sense when the environment_name is not tied to the actual server.

Separating Javascript exceptions into a separate project

Capturing Javascript exceptions can prove to be useful over time to pinpoint browser-specific errors that the QA rounds have missed. Unfortunately, enabling Javascript error notification usually brings you an enormous number of errors (and a lot of them unfixable, such as when a user on a faulty connection gets a Script load error). These errors flood out Rails exceptions and make Airbrake unusable, so most people turn Javascript error notification off and forget about it.

Most, but not us! I added a separate js_api_key Airbrake configuration option that allows you to direct Javascript exceptions to a second Airbrake project.

After that you can make use of the Airbrake error aggregation to see what exceptions are most common — and then you can start fixing them.

Have fun squashing those bugs out there!

Share
* Railsware is a premium software development consulting company, focused on delivering great web and mobile applications. Learn more about us.

Want to get more of Railsware blog?

RSS FEED

We're always ready to help!

CONTACT US