amarandon

amarandon

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.

Showing Posts 5 to 1

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.

amarandon

amarandon OP

Hi guys, thank you for taking the time to reply! Now I realize that my question wasn’t very clear, probably because the problem isn’t very clear in my head. My question was more about policies than about tooling.

So we currently use use FlexLogger to send messages with level info or higher to LogDNA (a log aggregation service). Then we configure LogDNA to send us alerts for messages with level error or higher. LogDNA already does some kind of error batching out of the box, similar to what @LostKobrakai suggested.

Still there are cases when we get alerts because there’s a transient error (say network connectivity issue) from which the system recovers thanks to our supervision tree. As I’ve read in @sasajuric’s book, among other sources, with Elixir one shouldn’t try to obsessively catch all errors but instead just “let it crash” and design a supervision tree that enables error recovery. This contrasts with what I’m used to for instance in Python where exceptions are never acceptable. In other words, from my experience it seems that exceptions aren’t that important in Elixir and at the moment I’m probably giving them too much visibility.

That’s why I’m wondering if instead of getting notified of all errors I should instead set up health checks that validate user-facing behavior and send alerts if any of these checks fail. Exceptions would then just get logged without triggering alerts. But then there’s the risk that being caught in daily tasks we’re never going to look at these exceptions and miss opportunities to anticipate issues that we would have been able to anticipate if we had seen them.

I’m sure there isn’t a general answer as where to draw the line is highly dependent on the context, but I was wondering if you’d be willing to share a bit how you manage alerts on your production services.

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.

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.

dimitarvp

dimitarvp

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

— All posts loaded —

Where Next? Top

Trending in Questions Top

water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Alvinkariuki
How Can I Optimise Compile Time Dependencies I have been building an elixir application for about 2 years now. Many modules and files ha...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New

Other Trending Topics Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews