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:

1try do
2  raise "Exception!"
3catch
4  kind, reason ->
5    Appsignal.set_error(kind, reason, __STACKTRACE__)
6end

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.

1try do
2  raise "Exception!"
3rescue
4  exception ->
5    Appsignal.set_error(exception, __STACKTRACE__)
6end

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.

1try do
2  raise "Exception!"
3rescue
4  exception ->
5    Appsignal.send_error(exception, __STACKTRACE__, fn(span) ->
6      Appsignal.Test.Span.set_attribute(span, "key", "value")
7    end)
8end

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 📧➡️😋

Share this article

RSS

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