2015-08-31

We are excited to share that you can now send exception information from your Elixir applications to Honeybadger! installation and configuration are very straight forward so we’re only going to look at how you use the Honeybadger package.

Let’s dive in and see how easy this is to get set up.

Phoenix Applications

There are many things to like about Phoenix but one of the very best is that core to Phoenix’s design is staying close to the Plug virtue of functions. Since Phoenix is so close to Plug, we can easily notify Honeybadger of any exceptions in your Phoenix application’s web requests. Just

the

module in your Phoenix application’s router and you’re done!

For debugging and customer experience purposes it can also be really helpful to send extra information about the request along with the exception. We provide the

function to accomplish this. A great technique is to add a

function that sets up the context for a request.

OTP Processes

Sometimes we have work that needs to be done outside of the web process so that we can return a response as fast as possible. Examples of this are sending email or updating third party APIs. If you follow the guidelines of OTP architecture then Honeybadger rewards you.

Any process that conforms to SASL error reporting requirements and crashes will send an error message to the logger. Examples of these process types are GenServers, GenEvents, Supervisors, and any processes spawned using

such as Tasks. This will be nearly all of the processes you have in any given application.

Simply set

to true when configuring Honeybadger and we will automatically take care of notifying Honeybadger of these crashes.

Manual Error Handling

While Elixir users inherit the Let It Crash mantra from our Erlang ancestors, the often untold, unsexy part of this is that we need to observe, understand and react to how our applications fail.

Sometimes we have critical code paths that need to succeed. If they don’t, we need to know why. You can manually call

to support these cases.

As a side note, the reason you need to

the Honeybadger module before calling

is because this function is actually a macro. With the power of a macro we can wipe away the function calls to notify in environments that you aren’t interested in having exception tracking, such as test and development. Pretty cool, eh?!

Conclusion

At ElixirConf Europe Michael Schäfermeyer gave an excellent talk on using Elixir in a high scale web application. One of the key takeaways from that talk for me was that Elixir is missing some of the tools we might be accustomed to in other languages. We hope that by supporting exception tracking for Elixir applications we are doing our part to help get the Elixir community one step closer.

Show more