amarandon

amarandon

How to monitor errors?

Coming from a non-BEAM language, I’m used to configure production services to send an alert message every time an exception occur on the server. I found that with beam’s fault-tolerance, this approach no longer works because Elixir errors aren’t necessary as bad: a process dies, its supervisor restarts it and the app keeps running fine. Getting an alert for each error raises a lot of false positives. Most of the time when we get an error alert, we check the app and it’s still behaving as it should. Yet, it’s still interesting to get information about these errors as it gives valuable feedback about how our app behaves. I’m thinking of turning off these alert messages while still logging errors and instead setup custom health checks based on expected observable behavior of our app. I’m wondering if some of you might have gone through a similar path when migrating to Elixir and what is your approach to monitoring the health of your app.

Most Liked

dimitarvp

dimitarvp

You can start with Sentry which has a good Elixir package. There’s also NewRelic, HoneyBadger, and others.

LostKobrakai

LostKobrakai

In AppSignal you can adjust how/when you’re getting notified about reoccurring errors. I guess similar methods might exist in other tools as well. So you don’t loose information, but you can adjust how they’re treated.

hauleth

hauleth

Second to @dimitarvp answer, but if you want to know how it is implemented on the “low level” then it is simple:

Just attach to :logger and handle messages for level :error and higher. As there are structured logs, then you can easily detect which one are caused by exceptions.

hauleth

hauleth

Since Elixir 1.10 it is no longer needed. You can use :logger functions directly, and in Elixir 1.11 there will be Logger.put_module_level/2 and Logger.delete_module_level/1 that will work (almost) exactly like the :level_config option from FlexLogger.

Where Next?

Popular in Questions Top

pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
wernerlaude
In AR this is so simple @articles = current_user.articles How to do in Ecto? def index(conn, _params) do current_user = conn.assig...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement