appsignal

AppSignal for Elixir Integration 2.1 Released

Jeff Kreeftmeijer

Jeff Kreeftmeijer on

AppSignal for Elixir Integration 2.1 Released

We're happy to announce the release of AppSignal for Elixir 2.1.0. 🥳 In this version, we’ve made our error helpers more flexible than before.

You could already send Elixir exceptions directly through AppSignal and now you can add extra metadata to errors when using send_error/2-4. Let's go through all of the changes 😀

Rescuing Errors

In 2.0.0, errors were set using kind, reason and stack, both internally and in custom instrumentation:

elixir
try do raise "Exception!" catch kind, reason -> Appsignal.set_error(kind, reason, __STACKTRACE__) end

We’ve implemented it like this to be able to differentiate between errors, exits, and throws internally.

In Elixir apps, errors are raised as exception structs. Although they can be caught using the catch keyword, Elixir also provides rescue, which returns the exception itself.

elixir
try do raise "Exception!" rescue exception -> Appsignal.set_error(exception, __STACKTRACE__) end

In 2.1.0, we’ve added set_error/2 and send_error/2, which take an exception, so you can catch errors using rescue instead of catch. This saves you from passing the “kind” argument, which is always :error when an exception is raised.

Adding Metadata to send_error/2-4

Our send_error/2-4 function now takes a function as the last argument. When sending an error, you can now use that function to add extra metadata before the created span is sent.

elixir
try do raise "Exception!" rescue exception -> Appsignal.send_error(exception, __STACKTRACE__, fn(span) -> Appsignal.Test.Span.set_attribute(span, "key", "value") end) end

If you're using custom instrumentation, this will come in handy for debugging as you can tag your error with more information.

Why and How to Upgrade to Elixir ~> 2.0

2.1.0 adds more customization to AppSignal for Elixir. If you haven't upgraded yet, we think you should 🙏

From version 2 onwards, the installation process is faster and instruments Ecto out of the box. We’ve moved our instrumentation over to Elixir’s Telemetry library, which is a big jump forward in specifying the root cause of errors.

Here's the upgrade guide explaining step by step how to upgrade.

Check Out AppSignal, We Have Stroopwafels 🍪

If you haven't tried AppSignal for monitoring your Elixir apps yet, take five minutes and check it out. There is a 30 day trial, with no credit card required.

As we're a Dutch company, we also ship stroopwafels (crazy good Dutch cookies) worldwide to our users. All you need to do to get your box is reach out to our support 📧➡️😋

Become our next author!

Find out more

AppSignal monitors your apps

AppSignal provides insights for Ruby, Rails, Elixir, Phoenix, Node.js, Express and many other frameworks and libraries. We are located in beautiful Amsterdam. We love stroopwafels. If you do too, let us know. We might send you some!

Discover AppSignal
AppSignal monitors your apps