A true alchemist is never done exploring. And neither are we. Sign up for our Elixir Alchemy email series and receive deep insights about Elixir, Phoenix and other developments.
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 😀
In 2.0.0, errors were set using
stack, both internally and in custom instrumentation:
1 2 3 4 5 6
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.
1 2 3 4 5 6
try do raise "Exception!" rescue exception -> Appsignal.set_error(exception, __STACKTRACE__) end
In 2.1.0, we’ve added
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.
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.
1 2 3 4 5 6 7 8
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.
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.
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 📧➡️😋